1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
import pytest
from bump_changelog import get_next_patch_version, transform_content
@pytest.mark.parametrize(
"version,expected", [["2.6.1", "2.6.2"], ["2.6.1-dev0", "2.6.2-dev0"]]
)
def test_get_next_version(version, expected):
assert get_next_patch_version(version) == expected
@pytest.mark.parametrize(
"old_content,expected_error",
[
[
"""
What's New in astroid 2.6.1?
============================
Release Date: TBA
What's New in astroid 2.6.0?
============================
Release Date: TBA
""",
"More than one release date 'TBA'",
],
[
"""===================
astroid's ChangeLog
===================
What's New in astroid 2.6.0?
============================
Release Date: TBA
""",
"text for this version '2.6.1' did not exists",
],
[
"""
What's New in astroid 2.6.2?
============================
Release Date: TBA
What's New in astroid 2.6.1?
============================
Release Date: 2012-02-05
""",
"the next version '2.6.2' already exists",
],
],
)
def test_update_content_error(old_content, expected_error):
with pytest.raises(AssertionError, match=expected_error):
transform_content(old_content, "2.6.1")
def test_update_content():
old_content = """
===================
astroid's ChangeLog
===================
What's New in astroid 2.6.1?
============================
Release Date: TBA
"""
expected_beginning = """
===================
astroid's ChangeLog
===================
What's New in astroid 2.6.2?
============================
Release Date: TBA
What's New in astroid 2.6.1?
============================
Release Date: 20"""
new_content = transform_content(old_content, "2.6.1")
assert new_content.startswith(expected_beginning)
|