Skip to content

Commit 652c165

Browse files
committed
test sdk: fix typing and codestyle errors
1 parent 33d0fee commit 652c165

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

sdk/test/adapter/aasx/test_aasx.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,12 @@ def test_write_missing_aas_objects(self):
106106
"/aasx/selection.xml",
107107
["https://acplt.org/Test_AssetAdministrationShell",
108108
"http://false-identifier.org/",
109-
"http://acplt.org/Submodels/Assets/TestAsset/Identification"],
109+
"http://acplt.org/Submodels/Assets/TestAsset/Identification"],
110110
data, aasx.DictSupplementaryFileContainer()
111111
)
112112

113-
self.assertIn("Could not find identifiable http://false-identifier.org/ in IdentifiableStore", log.output[0])
113+
self.assertIn("Could not find identifiable http://false-identifier.org/ in IdentifiableStore",
114+
log.output[0])
114115

115116
# assert only the two existing objects have been written to aasx file
116117
object_store = model.DictIdentifiableStore()
@@ -142,7 +143,7 @@ def test_writing_with_missing_file(self) -> None:
142143
self.assertIn("Could not find file", cm.exception.args[0])
143144

144145
def test_writing_file_twice(self) -> None:
145-
with tempfile.TemporaryDirectory() as tmpdir:
146+
with (tempfile.TemporaryDirectory() as tmpdir):
146147
tmpdir_path = Path(tmpdir)
147148

148149
# ---- Arange ----
@@ -167,7 +168,8 @@ def test_writing_file_twice(self) -> None:
167168
value=resulting_file_name
168169
)]
169170
)
170-
data = model.DictIdentifiableStore([first_submodel, second_submodel])
171+
data: model.DictIdentifiableStore[model.Identifiable] \
172+
= model.DictIdentifiableStore([first_submodel, second_submodel])
171173

172174
# ---- Act & Assert ----
173175
with self.assertNoLogs(level="WARNING"):
@@ -184,7 +186,6 @@ def test_write_non_aas(self) -> None:
184186
with open(Path(__file__).parent / "TestFile.pdf", "rb") as pdf:
185187
file_store.add_file("/TestFile.pdf", pdf, "application/pdf")
186188

187-
188189
# ---- Act & Assert ----
189190
# assert warning is present in failsafe mode
190191
with self.assertLogs(level="WARNING") as log:
@@ -199,7 +200,7 @@ def test_write_non_aas(self) -> None:
199200
# try to write a non AAS object
200201
writer.write_aas("https://acplt.org/Test_Submodel", data, file_store)
201202
self.assertIn("Identifier https://acplt.org/Test_Submodel does not belong "
202-
"to an AssetAdministrationShell",cm.exception.args[0])
203+
"to an AssetAdministrationShell", cm.exception.args[0])
203204

204205
def test_write_aas_missing_submodel(self) -> None:
205206
with tempfile.TemporaryDirectory() as tmpdir:
@@ -315,7 +316,6 @@ def test_write_core_properties_twice(self) -> None:
315316

316317
self.assertIn("Core Properties have already been written", cm.exception.args[0])
317318

318-
319319
def test_write_thumbnail_twice(self) -> None:
320320
with tempfile.TemporaryDirectory() as tmpdir:
321321
tmpdir_path = Path(tmpdir)
@@ -334,7 +334,6 @@ def test_write_thumbnail_twice(self) -> None:
334334

335335
self.assertIn("package thumbnail has already been written", cm.exception.args[0])
336336

337-
338337
def test_writing_reading_example_aas(self) -> None:
339338
# Create example data and file_store
340339
data = example_aas.create_full_example() # creates a complete, valid example AAS
@@ -457,7 +456,7 @@ def test_get_thumbnail(self) -> None:
457456
# ---- Arange ----
458457
tmpdir_path = Path(tmpdir)
459458

460-
data = model.DictIdentifiableStore([
459+
data: model.DictIdentifiableStore[model.Identifiable] = model.DictIdentifiableStore([
461460
model.AssetAdministrationShell(
462461
id_="http://example.org/Test_AAS",
463462
asset_information=model.AssetInformation(

sdk/test/adapter/test_load_directory.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ def test_reading_all_files(self):
6767
file_store=file_container
6868
)
6969

70-
7170
# ---- Act ----
7271
new_object_store, new_file_store = adapter.load_directory(temp_dir_path)
7372

@@ -80,7 +79,6 @@ def test_reading_all_files(self):
8079
# check pdf is loaded
8180
self.assertIn(resulting_file_name, new_file_store)
8281

83-
8482
def test_skipping_other_files(self):
8583
with tempfile.TemporaryDirectory() as tmp_dir:
8684
# ---- Arange ----
@@ -99,4 +97,4 @@ def test_skipping_other_files(self):
9997
# ---- Assert ----
10098
# check stores are empty
10199
self.assertEqual(len(object_store), 0)
102-
self.assertEqual(len(file_store), 0)
100+
self.assertEqual(len(file_store), 0)

0 commit comments

Comments
 (0)