Skip to content

Commit 1819baa

Browse files
committed
tests: verify ValueError results for repo __getitem__() calls
1 parent 9182c0a commit 1819baa

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

tests/repo/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ def test_getitem_base(self, repo):
120120
with pytest.raises(KeyError):
121121
_ = repo[obj]
122122

123+
# invalid key values
124+
for obj in ("<cat/pkg", "maintainer is"):
125+
with pytest.raises(ValueError):
126+
repo[obj]
127+
123128
# invalid key types
124129
for obj in (object(), None):
125130
with pytest.raises(TypeError):

tests/repo/test_set.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ def test_getitem(self, make_fake_repo):
171171
assert s[Dep("=cat/pkg-1::r2")] == pkg1
172172
assert s["cat/pkg-2"] == pkg2
173173

174+
# invalid key values
175+
for obj in ("<cat/pkg", "maintainer is"):
176+
with pytest.raises(ValueError):
177+
s[obj]
178+
174179
# invalid key types
175180
for obj in (object(), None):
176181
with pytest.raises(TypeError):

0 commit comments

Comments
 (0)