From 149be8781cde8ec434bdf34010d176af32cf3229 Mon Sep 17 00:00:00 2001 From: vky Date: Wed, 26 Jan 2022 20:30:59 +0100 Subject: [PATCH] created tests for pathresolver --- tests/modules/test_pathresolver.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/modules/test_pathresolver.py diff --git a/tests/modules/test_pathresolver.py b/tests/modules/test_pathresolver.py new file mode 100644 index 0000000..6ee6357 --- /dev/null +++ b/tests/modules/test_pathresolver.py @@ -0,0 +1,26 @@ +import bootstraparse.modules.pathresolver as pathr +import os +import re + +pathlike_regexp = r'^[A-z]\:\\.+[/\\]src[/\\]bootstraparse[/\\]?$' +test_path = '/a/b/c/test' +test_path_win = test_path.replace('/', '\\') + + +def test_pathresolver(): + path = pathr.pathresolver(test_path) + assert path() == os.path.normpath(test_path) + assert path() == test_path_win + assert path().replace('\\', '/') == test_path + + +def test_boostrapath(): + assert re.match(pathlike_regexp, pathr.boostrapath().giveabsolute()) is not None + + +def test_bpath(): + assert re.match(pathlike_regexp, pathr.bpath()) is not None + + +if __name__ == "__main__": + print(test_pathresolver())