PageRenderTime 417ms CodeModel.GetById 265ms app.highlight 3ms RepoModel.GetById 148ms app.codeStats 0ms

/Lib/distutils/tests/test_filelist.py

http://unladen-swallow.googlecode.com/
Python | 23 lines | 15 code | 5 blank | 3 comment | 1 complexity | 6411ca30f35619ba71cb2b2ae4fd28c6 MD5 | raw file
 1"""Tests for distutils.filelist."""
 2import unittest
 3from distutils.filelist import glob_to_re
 4
 5class FileListTestCase(unittest.TestCase):
 6
 7    def test_glob_to_re(self):
 8        # simple cases
 9        self.assertEquals(glob_to_re('foo*'), 'foo[^/]*$')
10        self.assertEquals(glob_to_re('foo?'), 'foo[^/]$')
11        self.assertEquals(glob_to_re('foo??'), 'foo[^/][^/]$')
12
13        # special cases
14        self.assertEquals(glob_to_re(r'foo\\*'), r'foo\\\\[^/]*$')
15        self.assertEquals(glob_to_re(r'foo\\\*'), r'foo\\\\\\[^/]*$')
16        self.assertEquals(glob_to_re('foo????'), r'foo[^/][^/][^/][^/]$')
17        self.assertEquals(glob_to_re(r'foo\\??'), r'foo\\\\[^/][^/]$')
18
19def test_suite():
20    return unittest.makeSuite(FileListTestCase)
21
22if __name__ == "__main__":
23    unittest.main(defaultTest="test_suite")