diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_glob.py | 10 | ||||
-rw-r--r-- | Lib/test/test_posixpath.py | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py index 31de30d..af81dab 100644 --- a/Lib/test/test_glob.py +++ b/Lib/test/test_glob.py @@ -48,6 +48,9 @@ class GlobTests(unittest.TestCase): self.mktemp('ZZZ') self.mktemp('a', 'bcd', 'EF') self.mktemp('a', 'bcd', 'efg', 'ha') + if hasattr(os, 'symlink'): + os.symlink(self.norm('broken'), self.norm('sym1')) + os.symlink(self.norm('broken'), self.norm('sym2')) def tearDown(self): deltree(self.tempdir) @@ -98,6 +101,13 @@ class GlobTests(unittest.TestCase): eq(self.glob('?a?', '*F'), map(self.norm, [os.path.join('aaa', 'zzzF'), os.path.join('aab', 'F')])) + def test_glob_broken_symlinks(self): + if hasattr(os, 'symlink'): + eq = self.assertSequencesEqual_noorder + eq(self.glob('sym*'), [self.norm('sym1'), self.norm('sym2')]) + eq(self.glob('sym1'), [self.norm('sym1')]) + eq(self.glob('sym2'), [self.norm('sym2')]) + def test_main(): run_unittest(GlobTests) diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index 1fc3e7c..0a6ed99 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -150,6 +150,7 @@ class PosixPathTest(unittest.TestCase): os.remove(test_support.TESTFN + "1") self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True) self.assertIs(posixpath.exists(test_support.TESTFN + "2"), False) + self.assertIs(posixpath.lexists(test_support.TESTFN + "2"), True) finally: if not f.close(): f.close() @@ -171,6 +172,7 @@ class PosixPathTest(unittest.TestCase): f.write("foo") f.close() self.assertIs(posixpath.exists(test_support.TESTFN), True) + self.assertIs(posixpath.lexists(test_support.TESTFN), True) finally: if not f.close(): f.close() |