Skip to content

Commit

Permalink
Adding tests for new versions
Browse files Browse the repository at this point in the history
  • Loading branch information
noahbroyles committed Jan 14, 2022
1 parent 1b75f10 commit 19d02c3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
Empty file added conftest.py
Empty file.
15 changes: 15 additions & 0 deletions tests/test_special_values.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import secsie



def test_null():
"""
Tests that secsie recognizes special values in config.
"""
config = secsie.parse_config(
"""
not-null = none # none is not converted to None in Python, 'null' is.
""")

assert config['not-null'] == 'none'

8 changes: 8 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import re
import secsie


def test_secsie_semver_syntax():
VERSION_EX = re.compile(r'^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$')
assert VERSION_EX.match(secsie.__version__.split('v')[1])
# assert secsie.__version__ == 'v2.1.0'
18 changes: 18 additions & 0 deletions tests/test_whitespace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import secsie


def test_whitespace_insensitivity():
"""
Tests that secsie ignores whitespace in attribute declaration lines
"""
config = secsie.parse_config(
"""
key = value
key2=value2
ur\t=mom
"""
)

assert config['key'] == 'value'
assert config['key2'] == 'value2'
assert config['ur'] == 'mom'

0 comments on commit 19d02c3

Please sign in to comment.