summaryrefslogtreecommitdiff
path: root/archaeological_context_records
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-03-26 17:27:41 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-07-21 15:07:41 +0200
commit5499e558a541a0c8740d608dc4446f64ebe774c6 (patch)
tree28fbac26740b4f2ea19a0261422deb7e46f7af65 /archaeological_context_records
parent62b34d0afb55a5c5c7bc1da22f0c0d293ee3936d (diff)
downloadIshtar-5499e558a541a0c8740d608dc4446f64ebe774c6.tar.bz2
Ishtar-5499e558a541a0c8740d608dc4446f64ebe774c6.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)