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

Function test_create_symbolic_reference

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

Source from the content-addressed store, hash-verified

697
698
699def test_create_symbolic_reference(testrepo: Repository) -> None:
700 repo = testrepo
701 # We add a tag as a new symbolic reference that always points to
702 # "refs/heads/master"
703 reference = repo.create_reference('refs/tags/beta', 'refs/heads/master')
704 assert reference.type == ReferenceType.SYMBOLIC
705 assert reference.target == 'refs/heads/master'
706 assert reference.raw_target == b'refs/heads/master'
707
708 # try to create existing symbolic reference
709 with pytest.raises(AlreadyExistsError) as error:
710 repo.create_reference('refs/tags/beta', 'refs/heads/master')
711 assert isinstance(error.value, ValueError)
712
713 # try to create existing symbolic reference with force
714 reference = repo.create_reference('refs/tags/beta', 'refs/heads/master', force=True)
715 assert reference.type == ReferenceType.SYMBOLIC
716 assert reference.target == 'refs/heads/master'
717 assert reference.raw_target == b'refs/heads/master'
718
719
720def test_create_symbolic_reference_with_message(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 1

create_referenceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…