Back to index

python3.2  3.2.2
Public Member Functions
test.test_fnmatch.FnmatchTestCase Class Reference

List of all members.

Public Member Functions

def check_match
def test_fnmatch
def test_mix_bytes_str
def test_fnmatchcase
def test_bytes

Detailed Description

Definition at line 8 of file test_fnmatch.py.


Member Function Documentation

def test.test_fnmatch.FnmatchTestCase.check_match (   self,
  filename,
  pattern,
  should_match = 1,
  fn = fnmatch 
)

Definition at line 10 of file test_fnmatch.py.

00010 
00011     def check_match(self, filename, pattern, should_match=1, fn=fnmatch):
00012         if should_match:
00013             self.assertTrue(fn(filename, pattern),
00014                          "expected %r to match pattern %r"
00015                          % (filename, pattern))
00016         else:
00017             self.assertTrue(not fn(filename, pattern),
00018                          "expected %r not to match pattern %r"
00019                          % (filename, pattern))

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 58 of file test_fnmatch.py.

00058 
00059     def test_bytes(self):
00060         self.check_match(b'test', b'te*')
00061         self.check_match(b'test\xff', b'te*\xff')
00062         self.check_match(b'foo\nbar', b'foo*')

Here is the call graph for this function:

Definition at line 20 of file test_fnmatch.py.

00020 
00021     def test_fnmatch(self):
00022         check = self.check_match
00023         check('abc', 'abc')
00024         check('abc', '?*?')
00025         check('abc', '???*')
00026         check('abc', '*???')
00027         check('abc', '???')
00028         check('abc', '*')
00029         check('abc', 'ab[cd]')
00030         check('abc', 'ab[!de]')
00031         check('abc', 'ab[de]', 0)
00032         check('a', '??', 0)
00033         check('a', 'b', 0)
00034 
00035         # these test that '\' is handled correctly in character sets;
00036         # see SF bug #409651
00037         check('\\', r'[\]')
00038         check('a', r'[!\]')
00039         check('\\', r'[!\]', 0)
00040 
00041         # test that filenames with newlines in them are handled correctly.
00042         # http://bugs.python.org/issue6665
00043         check('foo\nbar', 'foo*')
00044         check('foo\nbar\n', 'foo*')
00045         check('\nfoo', 'foo*', False)
00046         check('\n', '*')

Here is the call graph for this function:

Definition at line 53 of file test_fnmatch.py.

00053 
00054     def test_fnmatchcase(self):
00055         check = self.check_match
00056         check('AbC', 'abc', 0, fnmatchcase)
00057         check('abc', 'AbC', 0, fnmatchcase)

Here is the call graph for this function:

Definition at line 47 of file test_fnmatch.py.

00047 
00048     def test_mix_bytes_str(self):
00049         self.assertRaises(TypeError, fnmatch, 'test', b'*')
00050         self.assertRaises(TypeError, fnmatch, b'test', '*')
00051         self.assertRaises(TypeError, fnmatchcase, 'test', b'*')
00052         self.assertRaises(TypeError, fnmatchcase, b'test', '*')

Here is the call graph for this function:


The documentation for this class was generated from the following file: