Skip to content

Commit 43d15a8

Browse files
committed
tests: add repo __getitem__() tests
1 parent f94dfeb commit 43d15a8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/repo/test_base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ def test_contains(self, repo):
9494
with pytest.raises(TypeError):
9595
assert obj in repo
9696

97+
def test_getitem(self, repo):
98+
pkg = repo.create_pkg('cat/pkg-1')
99+
assert pkg == repo['cat/pkg-1']
100+
101+
for obj in ('cat/pkg-2', Cpv('cat/pkg-3')):
102+
with pytest.raises(KeyError):
103+
repo[obj]
104+
97105
def test_len(self, repo):
98106
# empty repo
99107
assert len(repo) == 0

0 commit comments

Comments
 (0)