mirror of
https://github.com/TECHNOFAB11/bumpver.git
synced 2026-02-02 15:45:11 +01:00
Code quality updates
This commit is contained in:
parent
95234dfd0b
commit
54a681bf34
14 changed files with 413 additions and 187 deletions
|
|
@ -1,22 +1,22 @@
|
|||
from pycalver import rewrite
|
||||
|
||||
|
||||
REWRITE_FIXTURE = """
|
||||
# This file is part of the pycalver project
|
||||
# https://github.com/mbarkhau/pycalver
|
||||
#
|
||||
# (C) 2018 Manuel Barkhau (@mbarkhau)
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
__version__ = "v201809.0002-beta"
|
||||
"""
|
||||
|
||||
|
||||
def test_rewrite_lines():
|
||||
old_lines = [
|
||||
"# This file is part of the pycalver project",
|
||||
"# https://github.com/mbarkhau/pycalver",
|
||||
"#",
|
||||
"# (C) 2018 Manuel Barkhau (@mbarkhau)",
|
||||
"# SPDX-License-Identifier: MIT",
|
||||
'',
|
||||
"import os",
|
||||
'',
|
||||
'__version__ = "v201809.0002-beta"',
|
||||
'DEBUG = os.environ.get("PYDEBUG", "0") == "1"',
|
||||
]
|
||||
old_lines = REWRITE_FIXTURE.splitlines()
|
||||
patterns = ['__version__ = "{version}"']
|
||||
new_version = "v201809.0003"
|
||||
new_lines = rewrite.rewrite_lines(old_lines, patterns, new_version)
|
||||
new_lines = rewrite.rewrite_lines(patterns, new_version, old_lines)
|
||||
|
||||
assert len(new_lines) == len(old_lines)
|
||||
assert new_version not in "\n".join(old_lines)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue