Use self.assertEqual
in tests instead of self.assertEquals
.
For historical reasons, some TestCase
methods had one or more aliases that are now deprecated.
Use the standardised assertEqual
so the code is simpler, easier to read, and more future-proof (because an implication of deprecation is it will eventually be removed).
If we spot this issue in your GitHub pull request we give this advice:
344 | + | class TestFeature(unittest.TestCase): | |
345 | + | def test_feature(self): | |
346 | + | self.assertEquals(int('1'), 1) |
- | self.assertEquals(int('1'), 1) |
+ | self.assertEqual(int('1'), 1) |
Use self.assertEqual
in tests instead of self.assertEquals
.
Code Review Doctor will run this check by default. No configuration is needed but the check can be turned on/off using check code avoid-assert-equals
in your pyproject.toml file.