MCPcopy Index your code
hub / github.com/python/cpython / test_char_set

Method test_char_set

Lib/test/test_fnmatch.py:97–121  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

95 check('usr\\bin', 'usr\\bin')
96
97 def test_char_set(self):
98 check = self.check_match
99 tescases = string.ascii_lowercase + string.digits + string.punctuation
100 for c in tescases:
101 check(c, '[az]', c in 'az')
102 check(c, '[!az]', c not in 'az')
103 # Case insensitive.
104 for c in tescases:
105 check(c, '[AZ]', (c in 'az') and IGNORECASE)
106 check(c, '[!AZ]', (c not in 'az') or not IGNORECASE)
107 for c in string.ascii_uppercase:
108 check(c, '[az]', (c in 'AZ') and IGNORECASE)
109 check(c, '[!az]', (c not in 'AZ') or not IGNORECASE)
110 # Repeated same character.
111 for c in tescases:
112 check(c, '[aa]', c == 'a')
113 # Special cases.
114 for c in tescases:
115 check(c, '[^az]', c in '^az')
116 check(c, '[[az]', c in '[az')
117 check(c, r'[!]]', c != ']')
118 check('[', '[')
119 check('[]', '[]')
120 check('[!', '[!')
121 check('[!]', '[!]')
122
123 def test_range(self):
124 check = self.check_match

Callers

nothing calls this directly

Calls 1

checkFunction · 0.70

Tested by

no test coverage detected