diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_special_values.py b/tests/test_special_values.py new file mode 100644 index 0000000..2d0efcb --- /dev/null +++ b/tests/test_special_values.py @@ -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' + \ No newline at end of file diff --git a/tests/test_version.py b/tests/test_version.py new file mode 100644 index 0000000..e8cccd0 --- /dev/null +++ b/tests/test_version.py @@ -0,0 +1,8 @@ +import re +import secsie + + +def test_secsie_semver_syntax(): + VERSION_EX = re.compile(r'^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?: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[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$') + assert VERSION_EX.match(secsie.__version__.split('v')[1]) + # assert secsie.__version__ == 'v2.1.0' diff --git a/tests/test_whitespace.py b/tests/test_whitespace.py new file mode 100644 index 0000000..4ab5584 --- /dev/null +++ b/tests/test_whitespace.py @@ -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'