MCPcopy Create free account
hub / github.com/libgit2/pygit2 / test_references_iterator_next_python

Function test_references_iterator_next_python

test/test_refs.py:403–432  ·  view source on GitHub ↗
(testrepo: Repository)

Source from the content-addressed store, hash-verified

401
402
403def test_references_iterator_next_python(testrepo: Repository) -> None:
404 repo = testrepo
405 repo.create_reference(
406 'refs/tags/version1', '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98'
407 )
408 repo.create_reference(
409 'refs/tags/version2', '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98'
410 )
411
412 refs = [(x.name, x.target) for x in repo.references.iterator()]
413 assert sorted(refs) == [
414 ('refs/heads/i18n', '5470a671a80ac3789f1a6a8cefbcf43ce7af0563'),
415 ('refs/heads/master', '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98'),
416 ('refs/tags/version1', '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98'),
417 ('refs/tags/version2', '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98'),
418 ]
419
420 branches = [
421 (x.name, x.target) for x in repo.references.iterator(ReferenceFilter.BRANCHES)
422 ]
423 assert sorted(branches) == [
424 ('refs/heads/i18n', '5470a671a80ac3789f1a6a8cefbcf43ce7af0563'),
425 ('refs/heads/master', '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98'),
426 ]
427
428 tags = [(x.name, x.target) for x in repo.references.iterator(ReferenceFilter.TAGS)]
429 assert sorted(tags) == [
430 ('refs/tags/version1', '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98'),
431 ('refs/tags/version2', '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98'),
432 ]
433
434
435def test_references_iterator_invalid_filter(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 2

create_referenceMethod · 0.80
iteratorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…