From 95d5584ef1f249a8ee6cc041c091ef0dd018baac Mon Sep 17 00:00:00 2001 From: Krzysztof G <60067306+gikf@users.noreply.github.com> Date: Mon, 26 Sep 2022 18:34:44 +0200 Subject: [PATCH] fix: use correct method for list comparing (#4) `assertAlmostEqual` is able to determine if lists are equal, but it cannot determine if corresponding elements are almost equal. `assertCountEqual` checks if lists have the same elements, regardless of the order. --- test_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_module.py b/test_module.py index d7cf8a6..dc41e52 100644 --- a/test_module.py +++ b/test_module.py @@ -8,8 +8,8 @@ class DemographicAnalyzerTestCase(unittest.TestCase): def test_race_count(self): actual = self.data['race_count'].tolist() expected = [27816, 3124, 1039, 311, 271] - self.assertAlmostEqual(actual, expected, msg="Expected race count values to be [27816, 3124, 1039, 311, 271]") - + self.assertCountEqual(actual, expected, msg="Expected race count values to be [27816, 3124, 1039, 311, 271]") + def test_average_age_men(self): actual = self.data['average_age_men'] expected = 39.4