test-dirs.py
27 lines
| 644 B
| text/x-python
|
PythonLexer
/ tests / test-dirs.py
Augie Fackler
|
r43799 | from __future__ import absolute_import | ||
import unittest | ||||
import silenttestrunner | ||||
r43923 | from mercurial import pathutil | |||
Augie Fackler
|
r43799 | |||
class dirstests(unittest.TestCase): | ||||
def testdirs(self): | ||||
for case, want in [ | ||||
(b'a/a/a', [b'a', b'a/a', b'']), | ||||
(b'alpha/beta/gamma', [b'', b'alpha', b'alpha/beta']), | ||||
]: | ||||
r43923 | d = pathutil.dirs({}) | |||
Augie Fackler
|
r43799 | d.addpath(case) | ||
self.assertEqual(sorted(d), sorted(want)) | ||||
def testinvalid(self): | ||||
with self.assertRaises(ValueError): | ||||
r43923 | d = pathutil.dirs({}) | |||
Augie Fackler
|
r43799 | d.addpath(b'a//b') | ||
if __name__ == '__main__': | ||||
silenttestrunner.main(__name__) | ||||