Skip to content

Commit eee0bc0

Browse files
authored
Merge pull request #98 from Exabyte-io/feature/SOF-7781
Feature/sof 7781
2 parents 55df201 + 06654c1 commit eee0bc0

File tree

5 files changed

+22
-36
lines changed

5 files changed

+22
-36
lines changed

src/py/mat3ra/ade/flavor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class FlavorInput(ExecutionUnitInputIdItemSchemaForPhysicsBasedSimulationEngines
1818

1919
pass
2020

21+
2122
class Flavor(FlavorSchema, InMemoryEntitySnakeCase):
2223
"""
2324
Flavor class representing a flavor of an executable.
@@ -38,4 +39,3 @@ class Flavor(FlavorSchema, InMemoryEntitySnakeCase):
3839
"""
3940

4041
input: List[FlavorInput] = Field(default_factory=list, description="Input templates for this flavor")
41-

tests/py/test_application.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
from mat3ra.utils import assertion
33

44
APPLICATION_DEFAULT_FIELDS = {
5-
"shortName": None,
6-
"summary": None,
7-
"build": None,
8-
"hasAdvancedComputeOptions": None,
9-
"isLicensed": None,
10-
"field_id": None,
11-
"slug": None,
12-
"systemName": None,
135
"schemaVersion": "2022.8.16",
146
"isDefault": False,
157
}

tests/py/test_context_provider.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33
from mat3ra.esse.models.context_provider import Name
44
from mat3ra.utils import assertion
55

6-
CONTEXT_PROVIDER_DEFAULT_FIELDS = {
7-
"domain": None,
8-
"entityName": None,
9-
"data": None,
10-
"extraData": None,
11-
"isEdited": None,
12-
"context": None,
13-
}
6+
CONTEXT_PROVIDER_DEFAULT_FIELDS = {}
147

158
CONTEXT_PROVIDER_MINIMAL_CONFIG = {
169
"name": Name.KGridFormDataManager,

tests/py/test_flavor.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
FLAVOR_MINIMAL_CONFIG = {
1515
"name": "scf",
16+
"executableId": "exe_123",
1617
}
1718

1819
FLAVOR_FULL_CONFIG = {
@@ -32,12 +33,14 @@
3233

3334
FLAVOR_TO_DICT_CONFIG = {
3435
"name": "scf",
36+
"executableId": "exe_123",
3537
"executableName": "pw.x",
3638
"applicationName": "espresso",
3739
}
3840

3941
FLAVOR_FROM_DICT_CONFIG = {
4042
"name": "scf",
43+
"executableId": "exe_123",
4144
"executableName": "pw.x",
4245
"applicationName": "espresso",
4346
"input": [{"name": "pw_scf.in", "templateName": "pw_scf"}],
@@ -46,9 +49,20 @@
4649

4750
FLAVOR_WITH_EXTRA_FIELDS_CONFIG = {
4851
"name": "scf",
52+
"executableId": "exe_123",
4953
"custom_field": "custom_value",
5054
}
5155

56+
EXPECTED_FLAVOR_TO_DICT = {
57+
"executableId": "exe_123",
58+
"executableName": "pw.x",
59+
"applicationName": "espresso",
60+
"input": [],
61+
"schemaVersion": "2022.8.16",
62+
"name": "scf",
63+
"isDefault": False,
64+
}
65+
5266

5367
def test_flavor_input_creation():
5468
config = FLAVOR_INPUT_MINIMAL_CONFIG
@@ -84,8 +98,8 @@ def test_flavor_with_all_fields():
8498
def test_flavor_to_dict():
8599
config = FLAVOR_TO_DICT_CONFIG
86100
flavor = Flavor(**config)
87-
expected = {**config}
88-
assertion.assert_deep_almost_equal(expected, flavor.model_dump(exclude_unset=True))
101+
assertion.assert_deep_almost_equal(EXPECTED_FLAVOR_TO_DICT, flavor.to_dict())
102+
89103

90104

91105
def test_flavor_from_dict():
@@ -99,4 +113,6 @@ def test_flavor_with_extra_fields():
99113
config = FLAVOR_WITH_EXTRA_FIELDS_CONFIG
100114
flavor = Flavor(**config)
101115
assert flavor.name == "scf"
102-
assert not hasattr(flavor, "custom_field")
116+
assert hasattr(flavor, "custom_field")
117+
assert flavor.custom_field == "custom_value"
118+
assert "custom_field" in flavor.to_dict()

tests/py/test_template.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,11 @@
44
from mat3ra.esse.models.context_provider import Name
55
from mat3ra.utils import assertion
66

7-
CONTEXT_PROVIDER_DEFAULT_FIELDS = {
8-
"domain": None,
9-
"entityName": None,
10-
"data": None,
11-
"extraData": None,
12-
"isEdited": None,
13-
"context": None,
14-
}
7+
CONTEXT_PROVIDER_DEFAULT_FIELDS = {}
158

169
TEMPLATE_DEFAULT_FIELDS = {
17-
"rendered": None,
18-
"applicationName": None,
19-
"applicationVersion": None,
20-
"executableName": None,
2110
"contextProviders": [],
22-
"isManuallyChanged": None,
2311
"schemaVersion": "2022.8.16",
24-
"systemName": None,
25-
"slug": None,
26-
"field_id": None,
2712
}
2813

2914
CONFIG_MINIMAL = {

0 commit comments

Comments
 (0)