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:
parent
f831f24802
commit
95d5584ef1
@ -8,8 +8,8 @@ class DemographicAnalyzerTestCase(unittest.TestCase):
|
|||||||
def test_race_count(self):
|
def test_race_count(self):
|
||||||
actual = self.data['race_count'].tolist()
|
actual = self.data['race_count'].tolist()
|
||||||
expected = [27816, 3124, 1039, 311, 271]
|
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):
|
def test_average_age_men(self):
|
||||||
actual = self.data['average_age_men']
|
actual = self.data['average_age_men']
|
||||||
expected = 39.4
|
expected = 39.4
|
||||||
|
Loading…
Reference in New Issue
Block a user