diff --git a/crates/ty_python_semantic/resources/mdtest/assignment/annotations.md b/crates/ty_python_semantic/resources/mdtest/assignment/annotations.md index 7d1f6b2e7dc0b..c0af0e723d894 100644 --- a/crates/ty_python_semantic/resources/mdtest/assignment/annotations.md +++ b/crates/ty_python_semantic/resources/mdtest/assignment/annotations.md @@ -927,7 +927,7 @@ def _(a: int | None): Regression test for [#1611](https://github.com/astral-sh/ty/issues/1611). - + ```py # error: [invalid-syntax] @@ -935,4 +935,4 @@ Regression test for [#1611](https://github.com/astral-sh/ty/issues/1611). a:' ``` - + diff --git a/crates/ty_python_semantic/resources/mdtest/generics/legacy/paramspec.md b/crates/ty_python_semantic/resources/mdtest/generics/legacy/paramspec.md index 5e3cbe38881ed..ef0c17e4e9d28 100644 --- a/crates/ty_python_semantic/resources/mdtest/generics/legacy/paramspec.md +++ b/crates/ty_python_semantic/resources/mdtest/generics/legacy/paramspec.md @@ -298,14 +298,14 @@ it having the same AST as the one without the parentheses. Both mypy and Pyright reveal_type(OnlyParamSpec[(int, str)]().attr) # revealed: (int, str, /) -> None ``` - + ```py # error: [invalid-syntax] reveal_type(OnlyParamSpec[]().attr) # revealed: (...) -> None ``` - + The square brackets can be omitted when `ParamSpec` is the only type variable diff --git a/crates/ty_python_semantic/resources/mdtest/generics/pep695/paramspec.md b/crates/ty_python_semantic/resources/mdtest/generics/pep695/paramspec.md index 377faa922db08..fc818abfdca3d 100644 --- a/crates/ty_python_semantic/resources/mdtest/generics/pep695/paramspec.md +++ b/crates/ty_python_semantic/resources/mdtest/generics/pep695/paramspec.md @@ -22,7 +22,7 @@ def foo1[**P]() -> None: TODO: This results in a lot of syntax errors mainly because the AST doesn't accept them in this position. The parser could do a better job in recovering from these errors. - + ```py # error: [invalid-syntax] @@ -37,7 +37,7 @@ def foo[**P: int]() -> None: pass ``` - + ## Default @@ -255,14 +255,14 @@ it having the same AST as the one without the parentheses. Both mypy and Pyright reveal_type(OnlyParamSpec[(int, str)]().attr) # revealed: (int, str, /) -> None ``` - + ```py # error: [invalid-syntax] reveal_type(OnlyParamSpec[]().attr) # revealed: (...) -> None ``` - + The square brackets can be omitted when `ParamSpec` is the only type variable diff --git a/crates/ty_python_semantic/resources/mdtest/import/star.md b/crates/ty_python_semantic/resources/mdtest/import/star.md index 4aa8c2766db07..d99ba49ca7b4b 100644 --- a/crates/ty_python_semantic/resources/mdtest/import/star.md +++ b/crates/ty_python_semantic/resources/mdtest/import/star.md @@ -1485,7 +1485,7 @@ _Z: bool = True `b.py`: - + ```py from a import *, _Y # error: [invalid-syntax] @@ -1509,6 +1509,6 @@ from a import *, _Y as fooo # error: [invalid-syntax] from a import *, *, _Y # error: [invalid-syntax] ``` - + [python language reference for import statements]: https://docs.python.org/3/reference/simple_stmts.html#the-import-statement diff --git a/crates/ty_python_semantic/resources/mdtest/suppressions/ty_ignore.md b/crates/ty_python_semantic/resources/mdtest/suppressions/ty_ignore.md index 0fc7d1e568ca6..1f5f8f4d92243 100644 --- a/crates/ty_python_semantic/resources/mdtest/suppressions/ty_ignore.md +++ b/crates/ty_python_semantic/resources/mdtest/suppressions/ty_ignore.md @@ -75,7 +75,7 @@ def test(a: f"f-string type annotation", b: b"byte-string-type-annotation"): ... ## Can't suppress syntax errors - + ```py # error: [invalid-syntax] @@ -84,7 +84,7 @@ def test($): # ty: ignore pass ``` - + ## Can't suppress `revealed-type` diagnostics @@ -127,14 +127,14 @@ a = 10 / 0 # ty: ignore[*-*] ## Trailing whitespace - + ```py a = 10 / 0 # ty: ignore[division-by-zero] # ^^^^^^ trailing whitespace ``` - + ## Missing comma diff --git a/crates/ty_python_semantic/resources/mdtest/t_strings.md b/crates/ty_python_semantic/resources/mdtest/t_strings.md index 97ebeed51a257..8625016dfa838 100644 --- a/crates/ty_python_semantic/resources/mdtest/t_strings.md +++ b/crates/ty_python_semantic/resources/mdtest/t_strings.md @@ -2,7 +2,7 @@ (NB: `black` does not support Python 3.14 at the time of this writing) - + ```toml [environment] diff --git a/crates/ty_test/src/parser.rs b/crates/ty_test/src/parser.rs index 30f0d8b24825c..0256287a6310a 100644 --- a/crates/ty_test/src/parser.rs +++ b/crates/ty_test/src/parser.rs @@ -520,7 +520,7 @@ impl<'s> Parser<'s> { const SECTION_CONFIG_SNAPSHOT: &str = "snapshot-diagnostics"; const SECTION_CONFIG_PULLTYPES: &str = "pull-types:skip"; const SECTION_CONFIG_EXPECT_PANIC: &str = "expect-panic"; - const HTML_COMMENT_ALLOWLIST: &[&str] = &["blacken-docs:on", "blacken-docs:off"]; + const HTML_COMMENT_ALLOWLIST: &[&str] = &["fmt:on", "fmt:off"]; const CODE_BLOCK_END: &[u8] = b"```"; const HTML_COMMENT_END: &[u8] = b"-->"; @@ -2066,13 +2066,13 @@ mod tests { let source = dedent( " # Some header - + ```py x = 1 ``` - + ", ); let parse_result = super::parse("file.md", &source);