diff options
| author | Michael Williamson <mike@zwobble.org> | 2018-01-24 08:35:02 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2018-01-24 08:35:02 +0000 |
| commit | 8f0d1c25178708d6b3878c7a433f07742bbba11c (patch) | |
| tree | 7fec40361f55352ed1eb044dfe66fef1b6ffbf8b /tests/zips_tests.py | |
| parent | d4acfff9f5f17630a153f12276fa8a2016052c8b (diff) | |
Extract code for manipulating zip paths
Diffstat (limited to 'tests/zips_tests.py')
| -rw-r--r-- | tests/zips_tests.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/zips_tests.py b/tests/zips_tests.py new file mode 100644 index 0000000..671b5cb --- /dev/null +++ b/tests/zips_tests.py @@ -0,0 +1,30 @@ +from nose.tools import istest, assert_equal + +from mammoth import zips + + +@istest +def split_path_splits_zip_paths_on_last_forward_slash(): + assert_equal(("a", "b"), zips.split_path("a/b")) + assert_equal(("a/b", "c"), zips.split_path("a/b/c")) + assert_equal(("/a/b", "c"), zips.split_path("/a/b/c")) + + +@istest +def when_path_has_no_forward_slashes_then_split_path_returns_empty_dirname(): + assert_equal(("", "name"), zips.split_path("name")) + + +@istest +def join_path_joins_arguments_with_forward_slashes(): + assert_equal("a/b", zips.join_path("a", "b")) + assert_equal("a/b/c", zips.join_path("a/b", "c")) + assert_equal("/a/b/c", zips.join_path("/a/b", "c")) + + +@istest +def empty_parts_are_ignored_when_joining_paths(): + assert_equal("a", zips.join_path("", "a")) + assert_equal("b", zips.join_path("", "b")) + assert_equal("a/b", zips.join_path("a", "", "b")) + |
