ruff/crates/red_knot_python_semantic/resources/mdtest
David Peter b33cf5baba
[red-knot] Move UnionBuilder tests to Markdown (#15374)
## Summary

This moves almost all of our existing `UnionBuilder` tests to a
Markdown-based test suite.

I see how this could be a more controversial change, since these tests
where written specifically for `UnionBuilder`, and by creating the union
types using Python type expressions, we add an additional layer on top
(parsing and inference of these expressions) that moves these tests away
from clean unit tests more in the direction of integration tests. Also,
there are probably a few implementation details of `UnionBuilder` hidden
in the test assertions (e.g. order of union elements after
simplifications).

That said, I think we would like to see all those properties that are
being tested here from *any* implementation of union types. And the
Markdown tests come with the usual advantages:

- More consice
- Better readability
- No re-compiliation when working on tests
- Easier to add additional explanations and structure to the test suite

This changeset adds a few additional tests, but keeps the logic of the
existing tests except for a few minor modifications for consistency.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com>
2025-01-09 21:45:06 +01:00
..
annotations Display Union of Literals as a Literal (#14993) 2025-01-08 00:58:38 +00:00
assignment [red-knot] add call checking (#15200) 2025-01-07 20:39:45 +00:00
binary Don't special-case class instances in binary expression inference (#15161) 2025-01-06 13:50:20 -05:00
boolean [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
call [red-knot] handle synthetic 'self' argument in call-binding diagnostics (#15362) 2025-01-09 00:36:48 -08:00
comparison Display Union of Literals as a Literal (#14993) 2025-01-08 00:58:38 +00:00
conditional [red-knot] fix control flow for assignment expressions in elif tests (#15274) 2025-01-05 18:35:29 +00:00
declaration [red-knot] Avoid undeclared path when raising conflicting declarations (#14958) 2024-12-17 09:49:39 +05:30
exception [red-knot] Report invalid exceptions (#15042) 2024-12-18 18:31:24 +00:00
expression Display Union of Literals as a Literal (#14993) 2025-01-08 00:58:38 +00:00
function [red-knot] function parameter types (#14802) 2024-12-06 12:55:56 -08:00
import Prioritize attribute in from/import statement (#15041) 2024-12-17 16:58:23 -05:00
literal [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
loops Display Union of Literals as a Literal (#14993) 2025-01-08 00:58:38 +00:00
narrow Display Union of Literals as a Literal (#14993) 2025-01-08 00:58:38 +00:00
regression [red-knot] Do not attach diagnostics to wrong file (#14337) 2024-11-14 15:39:51 +01:00
scopes Display Union of Literals as a Literal (#14993) 2025-01-08 00:58:38 +00:00
shadowing Test explicit shadowing involving defs (#15174) 2024-12-29 00:47:03 +00:00
stubs Allow assigning ellipsis literal as parameter default value (#14982) 2025-01-05 13:11:32 -06:00
subscript [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
suppressions @no_type_check support (#15122) 2024-12-30 09:42:18 +00:00
type_of [red-knot] Eagerly normalize type[] types (#15272) 2025-01-07 12:53:07 +00:00
type_properties [red-knot] More comprehensive is_assignable_to tests (#15353) 2025-01-08 20:25:08 +01:00
unary Don't special-case class instances in binary expression inference (#15161) 2025-01-06 13:50:20 -05:00
with [red-knot] Cleanup various todo_type!() messages (#15063) 2024-12-19 13:03:41 +00:00
.mdformat.toml [red-knot] have mdformat wrap mdtest files to 100 columns (#14020) 2024-10-31 21:00:51 +00:00
attributes.md [red-knot] Reduce TODOs in Type::member() (#15066) 2024-12-19 15:54:01 +00:00
final.md [red-knot] Add support for @final classes (#15070) 2024-12-19 21:02:14 +00:00
generics.md [red-knot] Add infrastructure to declare lints (#14873) 2024-12-10 16:14:44 +00:00
invalid_syntax.md [red-knot] Separate invalid syntax code snippets (#14803) 2024-12-06 02:41:33 +00:00
known_constants.md [red-knot] Support typing.TYPE_CHECKING (#14952) 2024-12-13 09:24:48 +00:00
mdtest_config.md Rename custom-typeshed-dir, target-version and current-directory CLI options (#14930) 2024-12-13 08:21:52 +00:00
metaclass.md [red-knot] More precise inference for classes with non-class metaclasses (#15138) 2025-01-09 00:34:04 +00:00
mro.md [red-knot] Add infrastructure to declare lints (#14873) 2024-12-10 16:14:44 +00:00
pep695_type_aliases.md [red-knot] mdtest: python version requirements (#14954) 2024-12-13 10:40:38 +01:00
slots.md Don't special-case class instances in binary expression inference (#15161) 2025-01-06 13:50:20 -05:00
statically_known_branches.md [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
sys_platform.md [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
sys_version_info.md Rename custom-typeshed-dir, target-version and current-directory CLI options (#14930) 2024-12-13 08:21:52 +00:00
type_api.md [red-knot] knot_extensions Python API (#15103) 2025-01-08 12:52:07 +01:00
union_types.md [red-knot] Move UnionBuilder tests to Markdown (#15374) 2025-01-09 21:45:06 +01:00
unpacking.md Display Union of Literals as a Literal (#14993) 2025-01-08 00:58:38 +00:00