ruff/crates/ty_python_semantic/resources/mdtest/import
Alex Waygood 1f8297cfe6
[ty] Improve error messages for unresolved attribute diagnostics (#20963)
## Summary

- Type checkers (and type-checker authors) think in terms of types, but
I think most Python users think in terms of values. Rather than saying
that a _type_ `X` "has no attribute `foo`" (which I think sounds strange
to many users), say that "an object of type `X` has no attribute `foo`"
- Special-case certain types so that the diagnostic messages read more
like normal English: rather than saying "Type `<class 'Foo'>` has no
attribute `bar`" or "Object of type `<class 'Foo'>` has no attribute
`bar`", just say "Class `Foo` has no attribute `bar`"

## Test Plan

Mdtests and snapshots updated
2025-10-19 10:58:25 +01:00
..
basic.md [ty] Check typeshed VERSIONS for parent modules when reporting failed stdlib imports (#20908) 2025-10-16 13:25:08 +00:00
builtins.md Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
case_sensitive.md
conditional.md [ty] No union with Unknown for module-global symbols (#20664) 2025-10-01 16:40:30 +02:00
conflicts.md
conventions.md [ty] Rename "possibly unbound" diagnostics to "possibly missing" (#20492) 2025-09-23 14:26:55 +00:00
cyclic.md [ty] Recognize submodules in self-referential imports (#18005) 2025-05-13 16:59:11 +02:00
dunder_all.md [ty] No union with Unknown for module-global symbols (#20664) 2025-10-01 16:40:30 +02:00
errors.md Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
invalid_syntax.md
legacy_namespace.md [ty] add legacy namespace package support (#20897) 2025-10-17 03:16:37 +00:00
module_getattr.md [ty] No union with Unknown for module-global symbols (#20664) 2025-10-01 16:40:30 +02:00
namespace.md [ty] No union with Unknown for module-global symbols (#20664) 2025-10-01 16:40:30 +02:00
partial_stub_packages.md [ty] Add link for namespaces being partial (#20015) 2025-08-20 21:28:57 -07:00
relative.md [ty] Improve error messages for unresolved attribute diagnostics (#20963) 2025-10-19 10:58:25 +01:00
site_packages_discovery.md [ty] Improve tests for site-packages discovery (#18374) 2025-05-30 07:32:21 +01:00
star.md [syntax-errors] Alternative match patterns bind different names (#20682) 2025-10-17 21:35:48 +00:00
stub_packages.md [ty] Fix relative imports in stub packages (#18132) 2025-05-16 15:30:10 +02:00
stubs.md
tracking.md Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00