diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2015-01-14 12:50:11 -0800 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2015-01-26 11:29:39 -0800 |
commit | 6d9a7b48dcd6a5c98544187d34270edfeb85728a (patch) | |
tree | 87a34ab5bebcf456ca922fc6570ac95d04a5bf7a | |
parent | 656b41d4891444a6e35beae41eca2486aaea54c7 (diff) |
grouptools.py: from_path should not return .
Since groups cannot be '.' (ie: 'foo/./bar' is not valid),
grouptools.from_path should not return '.', it should return ''
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
-rw-r--r-- | framework/grouptools.py | 4 | ||||
-rw-r--r-- | framework/tests/grouptools_tests.py | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/framework/grouptools.py b/framework/grouptools.py index 7a7a12733..3d26bbc2c 100644 --- a/framework/grouptools.py +++ b/framework/grouptools.py @@ -158,4 +158,8 @@ def from_path(path): if '\\' in path: return path.replace('\\', '/') + + if '.' == path: + return '' + return path diff --git a/framework/tests/grouptools_tests.py b/framework/tests/grouptools_tests.py index f65ad10c7..94f44af36 100644 --- a/framework/tests/grouptools_tests.py +++ b/framework/tests/grouptools_tests.py @@ -172,3 +172,8 @@ def test_from_path_posix(): def test_from_path_nt(): """grouptools.from_path: converts \\ to / in nt paths.""" nt.assert_equal(grouptools.from_path('foo\\bar'), 'foo/bar') + + +def test_from_path_dot(): + """grouptools.from_path: should convert '.' into ''.""" + nt.assert_equal(grouptools.from_path('.'), '') |