File tree Expand file tree Collapse file tree 3 files changed +34
-10
lines changed Expand file tree Collapse file tree 3 files changed +34
-10
lines changed Original file line number Diff line number Diff line change 19
19
_REGEX = re .compile (
20
20
r"""
21
21
^
22
- (?P<major>(?: 0|[1-9][0-9]*) )
22
+ (?P<major>0|[1-9]\d* )
23
23
\.
24
- (?P<minor>(?: 0|[1-9][0-9]*) )
24
+ (?P<minor>0|[1-9]\d* )
25
25
\.
26
- (?P<patch>(?: 0|[1-9][0-9]*) )
27
- (\ -(?P<prerelease>
28
- (?:0|[1-9A-Za-z -][0-9A-Za-z -]*)
29
- (\.(?:0|[1-9A-Za-z -][0-9A-Za-z -]*))*
26
+ (?P<patch>0|[1-9]\d* )
27
+ (?: -(?P<prerelease>
28
+ (?:0|[1-9]\d*|\d*[a-zA-Z -][0-9a-zA-Z -]*)
29
+ (?: \.(?:0|[1-9]\d*|\d*[a-zA-Z -][0-9a-zA-Z -]*))*
30
30
))?
31
- (\+(?P<build>
32
- [0-9A-Za-z -]+
33
- (\.[0-9A-Za-z -]+)*
31
+ (?: \+(?P<build>
32
+ [0-9a-zA-Z -]+
33
+ (?: \.[0-9a-zA-Z -]+)*
34
34
))?
35
35
$
36
36
""" , re .VERBOSE )
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def run_tests(self):
36
36
37
37
class Clean (CleanCommand ):
38
38
def run (self ):
39
- super ().run ()
39
+ super (CleanCommand , self ).run ()
40
40
delete_in_root = [
41
41
'build' ,
42
42
'.cache' ,
Original file line number Diff line number Diff line change @@ -70,6 +70,30 @@ def test_fordocstrings(func):
70
70
'prerelease' : 'alpha-1' ,
71
71
'build' : 'build.11.e0f985a' ,
72
72
}),
73
+ ("0.1.0-0f" ,
74
+ {
75
+ 'major' : 0 ,
76
+ 'minor' : 1 ,
77
+ 'patch' : 0 ,
78
+ 'prerelease' : '0f' ,
79
+ 'build' : None ,
80
+ }),
81
+ ("0.0.0-0foo.1" ,
82
+ {
83
+ 'major' : 0 ,
84
+ 'minor' : 0 ,
85
+ 'patch' : 0 ,
86
+ 'prerelease' : '0foo.1' ,
87
+ 'build' : None ,
88
+ }),
89
+ ("0.0.0-0foo.1+build.1" ,
90
+ {
91
+ 'major' : 0 ,
92
+ 'minor' : 0 ,
93
+ 'patch' : 0 ,
94
+ 'prerelease' : '0foo.1' ,
95
+ 'build' : 'build.1' ,
96
+ }),
73
97
])
74
98
def test_should_parse_version (version , expected ):
75
99
result = parse (version )
You can’t perform that action at this time.
0 commit comments