diff options
author | James R. Barlow <jim@purplerock.ca> | 2018-08-16 00:37:30 -0700 |
---|---|---|
committer | James R. Barlow <jim@purplerock.ca> | 2018-08-16 00:37:30 -0700 |
commit | c5821ef1016ae78451ab86ded6f4f07f75a16353 (patch) | |
tree | a0e40190ad6f7b86598b9f082ab20f799cb0fb1d /tests | |
parent | 3acca3c0ca85f6838884abc91eb474fb1469e9d6 (diff) |
Support syntax: "Name.Foo in dictionary"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_object.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_object.py b/tests/test_object.py index 601fa07..67d21af 100644 --- a/tests/test_object.py +++ b/tests/test_object.py @@ -160,6 +160,20 @@ def test_name_equality(): assert Name.Foo == Name('/Foo') +def test_dictionary_contains(): + d = Dictionary({ + '/Monty': 'Python', + '/Flying': 'Circus' + }) + assert Name.Flying in d + assert Name('/Monty') in d + assert Name.Brian not in d + + +def test_unslashed_name(): + with pytest.raises(ValueError, match='must begin with'): + Name('Monty') not in d + class TestHashViolation: def check(self, a, b): |