Test whether we can set the flags correctly. In this case, we disable all flags, which includes disabling Unicode mode. When we disable Unicode mode, we can match arbitrary possibly invalid UTF-8 bytes, such as \xFF. (When Unicode mode is enabled, \xFF won't match .)
(self)
| 108 | ) |
| 109 | |
| 110 | def test_flags(self): |
| 111 | """Test whether we can set the flags correctly. |
| 112 | |
| 113 | In this case, we disable all flags, which includes disabling |
| 114 | Unicode mode. When we disable Unicode mode, we can match |
| 115 | arbitrary possibly invalid UTF-8 bytes, such as \xFF. |
| 116 | (When Unicode mode is enabled, \xFF won't match .) |
| 117 | """ |
| 118 | pattern = b"." |
| 119 | haystack = b"\xFF" |
| 120 | re = Rure(pattern, flags=CASEI) |
| 121 | self.assertTrue(re.is_match(haystack)) |
| 122 | |
| 123 | def test_compile_error(self): |
| 124 | try: |