r"""When generating nodeids, if the source name contains special characters like a newline, they are escaped into two characters like \n. Therefore, a user will never need to insert a literal newline, only \n (two chars). So mark expressions themselves do not support escaping, instead th
()
| 71 | |
| 72 | |
| 73 | def test_backslash_not_treated_specially() -> None: |
| 74 | r"""When generating nodeids, if the source name contains special characters |
| 75 | like a newline, they are escaped into two characters like \n. Therefore, a |
| 76 | user will never need to insert a literal newline, only \n (two chars). So |
| 77 | mark expressions themselves do not support escaping, instead they treat |
| 78 | backslashes as regular identifier characters.""" |
| 79 | |
| 80 | def matcher(name: str, /, **kwargs: str | int | bool | None) -> bool: |
| 81 | return {r"\nfoo\n"}.__contains__(name) |
| 82 | |
| 83 | assert evaluate(r"\nfoo\n", matcher) |
| 84 | assert not evaluate(r"foo", matcher) |
| 85 | with pytest.raises(SyntaxError): |
| 86 | evaluate("\nfoo\n", matcher) |
| 87 | |
| 88 | |
| 89 | def test_backslash_in_identifier_with_string_literal() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…