Skip to content

Commit 695ce67

Browse files
committed
Code review changes
1 parent 0f63cd7 commit 695ce67

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

lambda_code/tests/test_mesh.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ def setUp(self):
107107
f"{self.data_path}/{self.failed_happy_output_file_name}"
108108
)
109109

110-
# with open(self.csv_file_path, "r", encoding="utf-8") as data:
111-
# self.sample_csv = data.read()
110+
with open(self.csv_file_path, "r", encoding="utf-8") as data:
111+
self.sample_csv = data.read()
112112

113113
self.successful_happy_output_file_path = (
114114
f"{self.data_path}/{self.successful_happy_output_file_name}"
@@ -126,26 +126,29 @@ def test_parse_csv(self):
126126
Test that we get a ImmunizationModel object and a ImmunizationErrorModel from parsing
127127
the CSV
128128
"""
129-
mesh_csv = MeshCsvParser(self.csv_file_path)
129+
mesh_csv = MeshCsvParser(self.sample_csv)
130130
records = mesh_csv.parse()
131131
self.assertEqual(len(records), 2)
132132

133133
def test_successful_immunizations_happy_output(self):
134134
"""Test that the successful immunization record is formatted correctly"""
135-
mesh_csv = MeshCsvParser(self.csv_file_path)
135+
mesh_csv = MeshCsvParser(self.sample_csv)
136136
immunisation_records, _ = mesh_csv.parse()
137137
immunisation_record_json = json.dumps(
138138
immunisation_records[0].dict(), indent=4, default=str
139139
)
140140

141-
assert json.loads(immunisation_record_json) == json.loads(
142-
self.successful_happy_output
141+
self.assertDictEqual(
142+
json.loads(immunisation_record_json),
143+
json.loads(self.successful_happy_output),
143144
)
144145

145146
def test_failed_immunizations_happy_output(self):
146147
"""Test that the failed immunization record is formatted correctly"""
147-
mesh_csv = MeshCsvParser(self.csv_file_path)
148+
mesh_csv = MeshCsvParser(self.sample_csv)
148149
_, failed_records = mesh_csv.parse()
149150
failed_record_json = json.dumps(failed_records[0].dict(), indent=4, default=str)
150151

151-
assert json.loads(failed_record_json) == json.loads(self.failed_happy_output)
152+
self.assertDictEqual(
153+
json.loads(failed_record_json), json.loads(self.failed_happy_output)
154+
)

0 commit comments

Comments
 (0)