2828import pytest
2929
3030import pygit2
31+ from pygit2 import Oid , Repository
3132from pygit2 .enums import DescribeStrategy , ObjectType
3233
3334
34- def add_tag (repo , name , target ) :
35+ def add_tag (repo : Repository , name : str , target : str ) -> Oid :
3536 message = 'Example tag.\n '
3637 tagger = pygit2 .Signature ('John Doe' , 'jdoe@example.com' , 12347 , 0 )
3738
3839 sha = repo .create_tag (name , target , ObjectType .COMMIT , tagger , message )
3940 return sha
4041
4142
42- def test_describe (testrepo ) :
43+ def test_describe (testrepo : Repository ) -> None :
4344 add_tag (testrepo , 'thetag' , '4ec4389a8068641da2d6578db0419484972284c8' )
4445 assert 'thetag-2-g2be5719' == testrepo .describe ()
4546
4647
47- def test_describe_without_ref (testrepo ) :
48+ def test_describe_without_ref (testrepo : Repository ) -> None :
4849 with pytest .raises (pygit2 .GitError ):
4950 testrepo .describe ()
5051
5152
52- def test_describe_default_oid (testrepo ) :
53+ def test_describe_default_oid (testrepo : Repository ) -> None :
5354 assert '2be5719' == testrepo .describe (show_commit_oid_as_fallback = True )
5455
5556
56- def test_describe_strategies (testrepo ) :
57+ def test_describe_strategies (testrepo : Repository ) -> None :
5758 assert 'heads/master' == testrepo .describe (describe_strategy = DescribeStrategy .ALL )
5859
5960 testrepo .create_reference (
@@ -66,14 +67,14 @@ def test_describe_strategies(testrepo):
6667 )
6768
6869
69- def test_describe_pattern (testrepo ) :
70+ def test_describe_pattern (testrepo : Repository ) -> None :
7071 add_tag (testrepo , 'private/tag1' , '5ebeeebb320790caf276b9fc8b24546d63316533' )
7172 add_tag (testrepo , 'public/tag2' , '4ec4389a8068641da2d6578db0419484972284c8' )
7273
7374 assert 'public/tag2-2-g2be5719' == testrepo .describe (pattern = 'public/*' )
7475
7576
76- def test_describe_committish (testrepo ) :
77+ def test_describe_committish (testrepo : Repository ) -> None :
7778 add_tag (testrepo , 'thetag' , 'acecd5ea2924a4b900e7e149496e1f4b57976e51' )
7879 assert 'thetag-4-g2be5719' == testrepo .describe (committish = 'HEAD' )
7980 assert 'thetag-1-g5ebeeeb' == testrepo .describe (committish = 'HEAD^' )
@@ -86,28 +87,28 @@ def test_describe_committish(testrepo):
8687 assert 'thetag-1-g6aaa262' == testrepo .describe (committish = '6aaa262' )
8788
8889
89- def test_describe_follows_first_branch_only (testrepo ) :
90+ def test_describe_follows_first_branch_only (testrepo : Repository ) -> None :
9091 add_tag (testrepo , 'thetag' , '4ec4389a8068641da2d6578db0419484972284c8' )
9192 with pytest .raises (KeyError ):
9293 testrepo .describe (only_follow_first_parent = True )
9394
9495
95- def test_describe_abbreviated_size (testrepo ) :
96+ def test_describe_abbreviated_size (testrepo : Repository ) -> None :
9697 add_tag (testrepo , 'thetag' , '4ec4389a8068641da2d6578db0419484972284c8' )
9798 assert 'thetag-2-g2be5719152d4f82c' == testrepo .describe (abbreviated_size = 16 )
9899 assert 'thetag' == testrepo .describe (abbreviated_size = 0 )
99100
100101
101- def test_describe_long_format (testrepo ) :
102+ def test_describe_long_format (testrepo : Repository ) -> None :
102103 add_tag (testrepo , 'thetag' , '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98' )
103104 assert 'thetag-0-g2be5719' == testrepo .describe (always_use_long_format = True )
104105
105106
106- def test_describe_dirty (dirtyrepo ) :
107+ def test_describe_dirty (dirtyrepo : Repository ) -> None :
107108 add_tag (dirtyrepo , 'thetag' , 'a763aa560953e7cfb87ccbc2f536d665aa4dff22' )
108109 assert 'thetag' == dirtyrepo .describe ()
109110
110111
111- def test_describe_dirty_with_suffix (dirtyrepo ) :
112+ def test_describe_dirty_with_suffix (dirtyrepo : Repository ) -> None :
112113 add_tag (dirtyrepo , 'thetag' , 'a763aa560953e7cfb87ccbc2f536d665aa4dff22' )
113114 assert 'thetag-dirty' == dirtyrepo .describe (dirty_suffix = '-dirty' )
0 commit comments