summaryrefslogtreecommitdiff
path: root/tests/common/pathname.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/common/pathname.py')
-rw-r--r--tests/common/pathname.py30
1 files changed, 8 insertions, 22 deletions
diff --git a/tests/common/pathname.py b/tests/common/pathname.py
index 00a084b..23ca2b0 100644
--- a/tests/common/pathname.py
+++ b/tests/common/pathname.py
@@ -1,10 +1,10 @@
from chrysacase import ChrysalideTestCase
-from pychrysalide.common import pathname
+from pychrysalide.common import build_relative_filename, build_absolute_filename
class TestPathnames(ChrysalideTestCase):
- """TestCase for common.pathname*"""
+ """TestCase for common pathname features."""
@classmethod
def setUpClass(cls):
@@ -58,11 +58,9 @@ class TestPathnames(ChrysalideTestCase):
def testBuildingRelative(self):
"""Build valid relative paths."""
- build_relative = pathname.build_relative_filename
-
for tst in self._tests:
- got = build_relative(tst['ref'], tst['target'])
+ got = build_relative_filename(tst['ref'], tst['target'])
self.assertEqual(got, tst['relative'])
@@ -70,11 +68,9 @@ class TestPathnames(ChrysalideTestCase):
def testBuildingAbsolute(self):
"""Build valid absolute paths."""
- build_absolute = pathname.build_absolute_filename
-
for tst in self._tests:
- got = build_absolute(tst['ref'], tst['relative'])
+ got = build_absolute_filename(tst['ref'], tst['relative'])
self.assertEqual(got, tst['target'])
@@ -82,29 +78,19 @@ class TestPathnames(ChrysalideTestCase):
def testBuildingWrongAbsolute(self):
"""Build invalid absolute paths."""
- build_absolute = pathname.build_absolute_filename
-
with self.assertRaisesRegex(Exception, 'Relative path is too deep.'):
- got = build_absolute('/a/b', '../../c')
-
-
- def testPathnameConstructor(self):
- """Check that no constructor is available for the pathname class."""
-
- with self.assertRaisesRegex(NotImplementedError, 'Chrysalide does not allow building this kind of object from Python'):
-
- instance = pathname()
+ got = build_absolute_filename('/a/b', '../../c')
def testPathnameSamples(self):
"""Play with some path samples."""
- filename = pathname.build_absolute_filename('/tmp/deep', '../myfile')
+ filename = build_absolute_filename('/tmp/deep', '../myfile')
self.assertEqual(filename, '/myfile')
- filename = pathname.build_absolute_filename('/tmp/deep/', '../myfile')
+ filename = build_absolute_filename('/tmp/deep/', '../myfile')
self.assertEqual(filename, '/tmp/myfile')
- filename = pathname.build_relative_filename('/tmp/deep', '/myfile')
+ filename = build_relative_filename('/tmp/deep', '/myfile')
self.assertEqual(filename, '../myfile')