File tree 4 files changed +10
-7
lines changed
4 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1
- from .semver import SemanticVersion
Original file line number Diff line number Diff line change 3
3
import bnfparsing
4
4
from .exceptions import InvalidSemver
5
5
6
- __location__ = os .path .realpath (os .path .join (os .getcwd (), os .path .dirname (__file__ )))
6
+ __location__ = os .path .realpath (
7
+ os .path .join (os .getcwd (), os .path .dirname (__file__ )))
7
8
8
9
9
10
class SemanticVersion :
10
11
spec_version = "2.0.0"
12
+
11
13
def __init__ (self , raw_string : str ):
12
14
self .raw_str = raw_string
13
15
try :
@@ -19,7 +21,7 @@ def __init__(self, raw_string: str):
19
21
class SemverParser (bnfparsing .ParserBase ):
20
22
def __init__ (self ):
21
23
super ().__init__ (ws_handler = bnfparsing .ignore )
22
- with open (os .path .join (__location__ ,'grammar.bnf' )) as grammar_file :
24
+ with open (os .path .join (__location__ , 'grammar.bnf' )) as grammar_file :
23
25
grammar = grammar_file .read ()
24
26
logging .debug ("Grammar loaded: %s" , grammar )
25
27
self .grammar (grammar )
Original file line number Diff line number Diff line change 12
12
'bnfparsing @ git+https://github.com/somemarsupials/bnfparsing@master'
13
13
],
14
14
zip_safe = False
15
- )
15
+ )
Original file line number Diff line number Diff line change 4
4
5
5
6
6
class TestSemver (unittest .TestCase ):
7
-
7
+
8
8
valid_versions = [
9
9
"1.2.3" ,
10
10
"1.2.0" ,
@@ -26,11 +26,13 @@ def test_valid_versions(self):
26
26
try :
27
27
SemanticVersion (version )
28
28
except InvalidSemver :
29
- self .fail (f"SemanticVersion reported { version } as being invalid!" )
29
+ self .fail (
30
+ f"SemanticVersion reported { version } as being invalid!" )
30
31
31
32
def test_invalid_versions (self ):
32
33
for version in self .invalid_versions :
33
34
self .assertRaises (InvalidSemver , SemanticVersion , version )
34
35
36
+
35
37
if __name__ == '__main__' :
36
- unittest .main ()
38
+ unittest .main ()
You can’t perform that action at this time.
0 commit comments