Coverage for tests/test_providers.py: 100.00%

15 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-02 00:26 +0200

1"""Test providers references parsing.""" 

2 

3from __future__ import annotations 

4 

5import git_changelog 

6 

7text = """ 

8This is the subject #1 

9 

10This is the body. Related: #2. Also mentions #3 and #4. 

11Closes #5. closed #6, #7. FIX: #89 and #10. 

12Resolve #1111. 

13Also support other projects references like shellm-org/shellm-data#19!! 

14Or fix pawamoy/git-changelog#1. 

15Don't match this one: #01. 

16 

17Now some other references: 

18 

19A merge request: !153! 

20A mention: @hello 

21A commit git-changelog@06abf793 

22A longer commit 3879fabda896da89954adec8 

23A commit range: 00000000...11111111 

24A snippet: $45 

25Some labels: ~18, ~bug, ~"multi word label" 

26Some milestones: %2, %version1, %"awesome version" 

27A Bitbucket PR: Pull request #1 

28A Bitbucket issue: Issue #1 

29""" 

30 

31 

32def test_github_issue_parsing() -> None: 

33 """GitHub issues are correctly parsed.""" # (first word *is* correctly capitalized) 

34 github = git_changelog.GitHub("pawamoy", "git-changelog") 

35 for ref in github.REF: 

36 assert github.get_refs(ref, text) 

37 

38 

39def test_gitlab_issue_parsing() -> None: 

40 """GitLab issues are correctly parsed.""" # (first word *is* correctly capitalized) 

41 gitlab = git_changelog.GitLab("pawamoy", "git-changelog") 

42 for ref in gitlab.REF: 

43 assert gitlab.get_refs(ref, text) 

44 

45 

46def test_bitbucket_issue_parsing() -> None: 

47 """Bitbucket issues are correctly parsed.""" 

48 bitbucket = git_changelog.Bitbucket("pawamoy", "git-changelog") 

49 for ref in bitbucket.REF: 

50 assert bitbucket.get_refs(ref, text)