diff options
author | Ben Brown <ben.brown@codethink.co.uk> | 2013-12-13 14:05:57 +0000 |
---|---|---|
committer | Ben Brown <ben.brown@codethink.co.uk> | 2013-12-16 15:25:15 +0000 |
commit | 53495e0a507a78e120d4589b52a59b5123c2ecfd (patch) | |
tree | a370e906caf48cf0ae8721c98b8b959376511c9d /morphlib/util_tests.py | |
parent | a127ae932b5941f4376f019e5983fcfadfcc068b (diff) | |
download | morph-53495e0a507a78e120d4589b52a59b5123c2ecfd.tar.gz |
Modify morph to strip .morph extensions from parameters
Diffstat (limited to 'morphlib/util_tests.py')
-rw-r--r-- | morphlib/util_tests.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/morphlib/util_tests.py b/morphlib/util_tests.py index fbf7f27b..5a8ae797 100644 --- a/morphlib/util_tests.py +++ b/morphlib/util_tests.py @@ -38,6 +38,28 @@ class IndentTests(unittest.TestCase): ' foo\n bar') +class StripMorphExtensionTests(unittest.TestCase): + + def test_raises_error_when_string_starts_with_period(self): + with self.assertRaises(morphlib.Error): + morphlib.util.strip_morph_extension('.morph') + + def test_strips_morph_extension_from_string(self): + self.assertEqual(morphlib.util.strip_morph_extension('a.morph'), 'a') + + def test_returns_morph_when_not_given_as_extension(self): + self.assertEqual(morphlib.util.strip_morph_extension('morph'), 'morph') + + def test_strips_extension_only_once_from_string(self): + self.assertEqual(morphlib.util.strip_morph_extension('a.morph.morph'), + 'a.morph') + + def test_returns_input_without_modification_if_no_extension(self): + self.assertEqual( + morphlib.util.strip_morph_extension('completely not a path'), + 'completely not a path') + + class MakeConcurrencyTests(unittest.TestCase): def test_returns_2_for_1_core(self): |