From cd69e9f1d7544756838f0f77893480c2a63c4919 Mon Sep 17 00:00:00 2001 From: Jono Xia Date: Tue, 5 Feb 2019 15:45:20 -0800 Subject: [PATCH] Issue #78 - made tests pass on python3 --- oblib/tests/test_data_model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oblib/tests/test_data_model.py b/oblib/tests/test_data_model.py index b0f3ccc..93b5279 100644 --- a/oblib/tests/test_data_model.py +++ b/oblib/tests/test_data_model.py @@ -419,7 +419,7 @@ def test_conversion_to_json(self): root = json.loads(jsonstring) # should have 2 facts: - all_facts = root["facts"].values() + all_facts = list(root["facts"].values()) self.assertEqual( len(all_facts), 2) # each should have expected 'value' and 'aspects': @@ -799,14 +799,14 @@ def test_decimals_and_precision(self): # TODO is supposed to be in aspects or not? self.assertEqual(len(facts), 1) - self.assertEqual(facts.values()[0]["aspects"]["precision"], "3") + self.assertEqual(list(facts.values())[0]["aspects"]["precision"], "3") doc.set("solar:ModuleNameplateCapacity", "6.25", unit_name="W", ProductIdentifierAxis = 1, decimals = 3) jsonstring = doc.to_JSON_string() facts = json.loads(jsonstring)["facts"] self.assertEqual(len(facts), 1) - self.assertEqual(facts.values()[0]["aspects"]["decimals"], "3") + self.assertEqual(list(facts.values())[0]["aspects"]["decimals"], "3") # Trying to set both decimals and precision should raise an error with self.assertRaises(OBException):