From f85da4c81d576b772e594718ad57a316cf544ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Thu, 28 Dec 2017 12:06:02 +0000 Subject: Use Python3 Enum class for glucose units. This makes the code more idiomatic and less brittle. --- test/test_common.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test_common.py b/test/test_common.py index 07b65d9..febf578 100644 --- a/test/test_common.py +++ b/test/test_common.py @@ -19,31 +19,31 @@ class TestCommon(unittest.TestCase): def test_glucose_conversion(self): self.assertEqual( 5.56, common.convert_glucose_unit( - 100, common.UNIT_MGDL, common.UNIT_MMOLL)) + 100, common.Unit.MG_DL, common.Unit.MMOL_L)) self.assertEqual( 5.56, common.convert_glucose_unit( - 100, common.UNIT_MGDL)) + 100, common.Unit.MG_DL)) self.assertEqual( 180, common.convert_glucose_unit( - 10, common.UNIT_MMOLL, common.UNIT_MGDL)) + 10, common.Unit.MMOL_L, common.Unit.MG_DL)) self.assertEqual( 180, common.convert_glucose_unit( - 10, common.UNIT_MMOLL)) + 10, common.Unit.MMOL_L)) self.assertEqual( 100, common.convert_glucose_unit( - 100, common.UNIT_MGDL, common.UNIT_MGDL)) + 100, common.Unit.MG_DL, common.Unit.MG_DL)) self.assertEqual( 10, common.convert_glucose_unit( - 10, common.UNIT_MMOLL, common.UNIT_MMOLL)) + 10, common.Unit.MMOL_L, common.Unit.MMOL_L)) self.assertRaises( exceptions.InvalidGlucoseUnit, - common.convert_glucose_unit, common.UNIT_MMOLL, 'foo') + common.convert_glucose_unit, common.Unit.MMOL_L, 'foo') if __name__ == '__main__': unittest.main() -- cgit v1.2.3