summaryrefslogtreecommitdiff
path: root/archaeological_context_records
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-08-20 15:42:38 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-10-15 19:32:59 +0200
commit7efe436fd9b794ed585a675bf0cbaf9ff4c8464d (patch)
tree7ead31f9d396e4202593e43c56e197ff2e84cfdd /archaeological_context_records
parent22089564f871cb265646e878291fecd423edf188 (diff)
downloadIshtar-7efe436fd9b794ed585a675bf0cbaf9ff4c8464d.tar.bz2
Ishtar-7efe436fd9b794ed585a675bf0cbaf9ff4c8464d.zip
🐛 fix unclosed file
Diffstat (limited to 'archaeological_context_records')
-rw-r--r--archaeological_context_records/tests.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py
index 79dd502ac..852cd3aa7 100644
--- a/archaeological_context_records/tests.py
+++ b/archaeological_context_records/tests.py
@@ -87,10 +87,10 @@ class ImportContextRecordTest(ImportTest, TestCase):
filename = root + "importer-GIS-UE.zip"
self.restore_serialized(filename)
imp_type = ImporterType.objects.get(name="GIS - UE")
- imp_file = open(root + data_name, "rb")
- file_dict = {
- "imported_file": SimpleUploadedFile(imp_file.name, imp_file.read())
- }
+ with open(root + data_name, "rb") as imp_file:
+ file_dict = {
+ "imported_file": SimpleUploadedFile(imp_file.name, imp_file.read())
+ }
post_dict = {
"importer_type": imp_type.pk,
"name": "cr_geo_import",
@@ -1889,7 +1889,8 @@ class GraphGenerationTest(ContextRecordInit, TestCase):
self.assertIsNotNone(cr_2.relation_image)
self.assertIsNotNone(cr_2.relation_bitmap_image)
self.assertIsNotNone(cr_2.relation_dot)
- content = open(cr_2.relation_dot.path).read()
+ with open(cr_2.relation_dot.path) as f:
+ content = f.read()
self.assertIn('"CR 1"', content)
self.assertIn('"CR 1B"', content)
self.assertIn('"CR 2B"', content)
@@ -1907,7 +1908,8 @@ class GraphGenerationTest(ContextRecordInit, TestCase):
self.assertIsNotNone(operation.relation_image)
self.assertIsNotNone(operation.relation_bitmap_image)
self.assertIsNotNone(operation.relation_dot)
- content = open(operation.relation_dot.path).read()
+ with open(operation.relation_dot.path) as f:
+ content = f.read()
self.assertIn('"CR 1"', content)
self.assertIn('"CR 1B"', content)
self.assertIn('"CR 2B"', content)
@@ -1924,7 +1926,8 @@ class GraphGenerationTest(ContextRecordInit, TestCase):
self.assertIsNotNone(cr_2.relation_image_above)
self.assertIsNotNone(cr_2.relation_bitmap_image_above)
self.assertIsNotNone(cr_2.relation_dot_above)
- content = open(cr_2.relation_dot_above.path).read()
+ with open(cr_2.relation_dot_above.path) as f:
+ content = f.read()
self.assertNotIn('"CR 1"', content)
self.assertNotIn('"CR 1B"', content)
self.assertIn('"CR 2B"', content)
@@ -1941,7 +1944,8 @@ class GraphGenerationTest(ContextRecordInit, TestCase):
self.assertIsNotNone(cr_2.relation_image_below)
self.assertIsNotNone(cr_2.relation_bitmap_image_below)
self.assertIsNotNone(cr_2.relation_dot_below)
- content = open(cr_2.relation_dot_below.path).read()
+ with open(cr_2.relation_dot_below.path) as f:
+ content = f.read()
self.assertIn('"CR 1"', content)
self.assertIn('"CR 1B"', content)
self.assertIn('"CR 2B"', content)