-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_changesgen.py
More file actions
71 lines (53 loc) · 1.78 KB
/
test_changesgen.py
File metadata and controls
71 lines (53 loc) · 1.78 KB
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
from changesgen import changes_to_text, extract_update_section, rst_to_text
def test_extraction_section_trio():
extracted_section = extract_update_section(
'0.26.2',
'0.27.0',
'python-trio',
"""
- not yet included
Trio 0.27.0
included text
Trio 0.26.2 (2024-08-08)
- no longer included
""".splitlines(),
)
assert 'not yet included' not in extracted_section
assert 'included text' in extracted_section
assert 'no longer included' not in extracted_section
def test_strip_github_issues():
"""Test that github references at the end of a one liner PR summary are removed"""
assert (
changes_to_text(
'some description :github-issue:`768` (:github-user:`apjama`)\n'
)
== ' * some description'
)
assert changes_to_text('Something done here (#123)\n') == ' * Something done here'
def test_rst_to_text():
"""Handle the standard CHANGES.rst formats correctly"""
assert (
rst_to_text("""
`3.5.3`_ - 2024-08-01
---------------------
**Fixed**
- django-rest-framework: MoneyField does not work anymore with custom serializer fields :github-issue:`768` (:github-user:`apjama`)
**Added**
- Django 5.1 support :github-issue:`767` (:github-user:`benjaoming`)
""")
== """ * django-rest-framework: MoneyField does not work anymore with
custom serializer fields
* Django 5.1 support
"""
)
assert (
rst_to_text("""
1.20.0 (2024-07-19)
-------------------
* Fix the ``admin_register`` fixer to avoid rewriting when there are duplicate ``ModelAdmin`` classes in the file.
`Issue #471 <https://github.com/link/to/471>`__.
""")
== """ * Fix the admin_register fixer to avoid rewriting when there
are duplicate ModelAdmin classes in the file. Issue #471.
"""
)