(self)
| 38 | self.assertEqual(function(value), output) |
| 39 | |
| 40 | def test_escape(self): |
| 41 | items = ( |
| 42 | ("&", "&"), |
| 43 | ("<", "<"), |
| 44 | (">", ">"), |
| 45 | ('"', """), |
| 46 | ("'", "'"), |
| 47 | ) |
| 48 | # Substitution patterns for testing the above items. |
| 49 | patterns = ("%s", "asdf%sfdsa", "%s1", "1%sb") |
| 50 | for value, output in items: |
| 51 | with self.subTest(value=value, output=output): |
| 52 | for pattern in patterns: |
| 53 | with self.subTest(value=value, output=output, pattern=pattern): |
| 54 | self.check_output(escape, pattern % value, pattern % output) |
| 55 | self.check_output( |
| 56 | escape, lazystr(pattern % value), pattern % output |
| 57 | ) |
| 58 | # Check repeated values. |
| 59 | self.check_output(escape, value * 2, output * 2) |
| 60 | # Verify it doesn't double replace &. |
| 61 | self.check_output(escape, "<&", "<&") |
| 62 | |
| 63 | def test_format_html(self): |
| 64 | self.assertEqual( |
nothing calls this directly
no test coverage detected