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.
This commit is contained in:
Krzysztof G 2022-09-26 18:34:44 +02:00 committed by GitHub
parent f831f24802
commit 95d5584ef1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ 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']