File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 19
19
\.
20
20
(?P<patch>(?:0|[1-9][0-9]*))
21
21
(\-(?P<prerelease>
22
- [1-9A-Za-z-][0-9A-Za-z-]*
23
- (\.[1-9A-Za-z-][0-9A-Za-z-]*)*
22
+ (?:0| [1-9A-Za-z-][0-9A-Za-z-]*)
23
+ (\.(?:0| [1-9A-Za-z-][0-9A-Za-z-]*) )*
24
24
))?
25
25
(\+(?P<build>
26
26
[0-9A-Za-z-]+
Original file line number Diff line number Diff line change @@ -33,6 +33,28 @@ def test_should_parse_version():
33
33
}
34
34
35
35
36
+ def test_should_parse_zero_prerelease ():
37
+ result = parse ("1.2.3-rc.0+build.0" )
38
+
39
+ assert result == {
40
+ 'major' : 1 ,
41
+ 'minor' : 2 ,
42
+ 'patch' : 3 ,
43
+ 'prerelease' : 'rc.0' ,
44
+ 'build' : 'build.0' ,
45
+ }
46
+
47
+ result = parse ("1.2.3-rc.0.0+build.0" )
48
+
49
+ assert result == {
50
+ 'major' : 1 ,
51
+ 'minor' : 2 ,
52
+ 'patch' : 3 ,
53
+ 'prerelease' : 'rc.0.0' ,
54
+ 'build' : 'build.0' ,
55
+ }
56
+
57
+
36
58
def test_should_get_less ():
37
59
assert compare ("1.0.0" , "2.0.0" ) == - 1
38
60
You can’t perform that action at this time.
0 commit comments