-
-
Notifications
You must be signed in to change notification settings - Fork 577
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bf6d80
commit f7ec885
Showing
6 changed files
with
80 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import pytest | ||
|
||
import pybamm | ||
import uuid | ||
|
||
|
||
class TestConfig: | ||
def test_write_read_uuid(self, tmp_path): | ||
# Create a temporary file path | ||
config_file = tmp_path / "config.yml" | ||
|
||
# Call the function to write UUID to file | ||
pybamm.config.write_uuid_to_file(config_file) | ||
|
||
# Check that the file was created | ||
assert config_file.exists() | ||
|
||
# Read the UUID using the read_uuid_from_file function | ||
uuid_dict = pybamm.config.read_uuid_from_file(config_file) | ||
|
||
# Check that the UUID was read successfully | ||
assert uuid_dict is not None | ||
assert "uuid" in uuid_dict | ||
|
||
# Verify that the UUID is valid | ||
|
||
try: | ||
uuid.UUID(uuid_dict["uuid"]) | ||
except ValueError: | ||
pytest.fail("Invalid UUID format") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import pytest | ||
|
||
import pybamm | ||
import uuid | ||
|
||
|
||
class TestConfig: | ||
def test_write_read_uuid(self, tmp_path): | ||
# Create a temporary file path | ||
config_file = tmp_path / "config.yml" | ||
|
||
# Call the function to write UUID to file | ||
pybamm.config.write_uuid_to_file(config_file) | ||
|
||
# Check that the file was created | ||
assert config_file.exists() | ||
|
||
# Read the UUID using the read_uuid_from_file function | ||
uuid_dict = pybamm.config.read_uuid_from_file(config_file) | ||
|
||
# Check that the UUID was read successfully | ||
assert uuid_dict is not None | ||
assert "uuid" in uuid_dict | ||
|
||
# Verify that the UUID is valid | ||
|
||
try: | ||
uuid.UUID(uuid_dict["uuid"]) | ||
except ValueError: | ||
pytest.fail("Invalid UUID format") |