forked from mendersoftware/mender-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_autoversion.py
executable file
·32 lines (25 loc) · 1.09 KB
/
test_autoversion.py
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
#!/usr/bin/python3
import re
import autoversion
def test_version_regex():
regex = autoversion.VERSION_MATCHER
# Should match.
assert re.search(regex, "1.2.3") is not None
assert re.search(regex, "release_2_1.2.3") is not None
assert re.search(regex, "release_2_1.2.3.mender") is not None
assert re.search(regex, "release_2_1.2.3_mender") is not None
assert re.search(regex, "release.2_1.2.3_mender") is not None
assert re.search(regex, "release.2_1.2.3.mender") is not None
assert re.search(regex, "release.2_1.2.3_2") is not None
assert re.search(regex, "release.2_master_2") is not None
assert re.search(regex, "morty") is not None
# Should not match.
assert re.search(regex, "1.2.3.4") is None
assert re.search(regex, "11.2.3.4") is None
assert re.search(regex, "1.2.3.14") is None
assert re.search(regex, "2.1.2.3.4") is None
assert re.search(regex, "22.1.2.3.4") is None
assert re.search(regex, "22.11.2.3.4") is None
assert re.search(regex, "127.0.0.1") is None
assert re.search(regex, "mortyxxx") is None
test_version_regex()