diff options
| author | kimbo <kimballleavitt@gmail.com> | 2021-02-16 15:21:13 -0700 |
|---|---|---|
| committer | kimbo <kimballleavitt@gmail.com> | 2021-02-16 15:21:13 -0700 |
| commit | 7d4d4715b5ebbe01cc4e4a0da662116263d747b1 (patch) | |
| tree | 1d24e0c8e817d5e6629391db4b44d6ad7f7c1126 /tests | |
| parent | a9dc095ad49d1e1a11197af31b188bb7c50d85de (diff) | |
| download | dnspython-7d4d4715b5ebbe01cc4e4a0da662116263d747b1.tar.gz | |
make `name in zone` consistent with `zone[name]`
specifically, allow name to be a str, and raise a KeyError if name
cannot be converted into a dns.name.Name
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_zone.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_zone.py b/tests/test_zone.py index 66f3ad5..26adc87 100644 --- a/tests/test_zone.py +++ b/tests/test_zone.py @@ -872,5 +872,15 @@ class VersionedZoneTestCase(unittest.TestCase): rds = txn.get('example.', 'soa') self.assertEqual(rds[0].serial, 1) + def testNameInZoneWithStr(self): + z = dns.zone.from_text(example_text, 'example.', relativize=False) + self.assertTrue('ns1.example.' in z) + self.assertTrue('bar.foo.example.' in z) + + def testNameInZoneWhereNameIsNotValid(self): + z = dns.zone.from_text(example_text, 'example.', relativize=False) + with self.assertRaises(KeyError): + self.assertTrue(1 in z) + if __name__ == '__main__': unittest.main() |
