diff --git a/test-data/unit/check-classes.test b/test-data/unit/check-classes.test index ec09c517c92e..0e5e858e59ae 100644 --- a/test-data/unit/check-classes.test +++ b/test-data/unit/check-classes.test @@ -7810,6 +7810,12 @@ class D: return C() def g(self) -> None: - # TODO: This is a false positive + # iter(x) looks up `__iter__` on the type of x rather than x itself, + # so this is correct behaviour. + # Instances of C should not be treated as being iterable, + # despite having a __getattr__ method + # that could allow for arbitrary attributes to be accessed on instances, + # since `type(C()).__iter__` still raises AttributeError at runtime, + # and that's what matters. a, b = self.f() # E: "C" has no attribute "__iter__" (not iterable) [builtins fixtures/tuple.pyi]