diff options
| author | Brian Wellington <bwelling@xbill.org> | 2020-03-18 11:26:55 -0700 |
|---|---|---|
| committer | Brian Wellington <bwelling@xbill.org> | 2020-03-18 11:26:55 -0700 |
| commit | e6798e58b4555740db4cfb43c8b9ce0d7d3416f1 (patch) | |
| tree | 7a2a5286ca49e0fe814eef39082a6d59b3d7289a /tests/test_flags.py | |
| parent | fc74c9261dcd36fd1ec0f10d48c9c0fc56ce17ea (diff) | |
| download | dnspython-e6798e58b4555740db4cfb43c8b9ce0d7d3416f1.tar.gz | |
Improve assertion checking.
This replaces lots of self.assertTrue() assertions with more specific
assertions, such as replacing assertTrue(x == y) with assertEqual(x, y).
Diffstat (limited to 'tests/test_flags.py')
| -rw-r--r-- | tests/test_flags.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/test_flags.py b/tests/test_flags.py index 20c200d..f3e7f84 100644 --- a/tests/test_flags.py +++ b/tests/test_flags.py @@ -24,24 +24,24 @@ import dns.opcode class FlagsTestCase(unittest.TestCase): def test_rcode1(self): - self.assertTrue(dns.rcode.from_text('FORMERR') == dns.rcode.FORMERR) + self.assertEqual(dns.rcode.from_text('FORMERR'), dns.rcode.FORMERR) def test_rcode2(self): - self.assertTrue(dns.rcode.to_text(dns.rcode.FORMERR) == "FORMERR") + self.assertEqual(dns.rcode.to_text(dns.rcode.FORMERR), "FORMERR") def test_rcode3(self): - self.assertTrue(dns.rcode.to_flags(dns.rcode.FORMERR) == (1, 0)) + self.assertEqual(dns.rcode.to_flags(dns.rcode.FORMERR), (1, 0)) def test_rcode4(self): - self.assertTrue(dns.rcode.to_flags(dns.rcode.BADVERS) == \ - (0, 0x01000000)) + self.assertEqual(dns.rcode.to_flags(dns.rcode.BADVERS), + (0, 0x01000000)) def test_rcode6(self): - self.assertTrue(dns.rcode.from_flags(0, 0x01000000) == \ - dns.rcode.BADVERS) + self.assertEqual(dns.rcode.from_flags(0, 0x01000000), + dns.rcode.BADVERS) def test_rcode7(self): - self.assertTrue(dns.rcode.from_flags(5, 0) == dns.rcode.REFUSED) + self.assertEqual(dns.rcode.from_flags(5, 0), dns.rcode.REFUSED) def test_rcode8(self): def bad(): @@ -49,12 +49,12 @@ class FlagsTestCase(unittest.TestCase): self.assertRaises(ValueError, bad) def test_flags1(self): - self.assertTrue(dns.flags.from_text("RA RD AA QR") == \ - dns.flags.QR|dns.flags.AA|dns.flags.RD|dns.flags.RA) + self.assertEqual(dns.flags.from_text("RA RD AA QR"), + dns.flags.QR|dns.flags.AA|dns.flags.RD|dns.flags.RA) def test_flags2(self): flags = dns.flags.QR|dns.flags.AA|dns.flags.RD|dns.flags.RA - self.assertTrue(dns.flags.to_text(flags) == "QR AA RD RA") + self.assertEqual(dns.flags.to_text(flags), "QR AA RD RA") if __name__ == '__main__': |
