mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 05:44:56 +00:00
[ty] Mark all_type_assignable_to_iterable_are_iterable
as flaky (#19574)
This commit is contained in:
parent
469c50b0b7
commit
df5eba7583
1 changed files with 15 additions and 11 deletions
|
@ -68,7 +68,7 @@ macro_rules! type_property_test {
|
||||||
|
|
||||||
mod stable {
|
mod stable {
|
||||||
use super::union;
|
use super::union;
|
||||||
use crate::types::{CallableType, KnownClass, Type};
|
use crate::types::{CallableType, Type};
|
||||||
|
|
||||||
// Reflexivity: `T` is equivalent to itself.
|
// Reflexivity: `T` is equivalent to itself.
|
||||||
type_property_test!(
|
type_property_test!(
|
||||||
|
@ -205,16 +205,6 @@ mod stable {
|
||||||
all_fully_static_type_pairs_are_subtype_of_their_union, db,
|
all_fully_static_type_pairs_are_subtype_of_their_union, db,
|
||||||
forall fully_static_types s, t. s.is_subtype_of(db, union(db, [s, t])) && t.is_subtype_of(db, union(db, [s, t]))
|
forall fully_static_types s, t. s.is_subtype_of(db, union(db, [s, t])) && t.is_subtype_of(db, union(db, [s, t]))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Any type assignable to `Iterable[object]` should be considered iterable.
|
|
||||||
//
|
|
||||||
// Note that the inverse is not true, due to the fact that we recognize the old-style
|
|
||||||
// iteration protocol as well as the new-style iteration protocol: not all objects that
|
|
||||||
// we consider iterable are assignable to `Iterable[object]`.
|
|
||||||
type_property_test!(
|
|
||||||
all_type_assignable_to_iterable_are_iterable, db,
|
|
||||||
forall types t. t.is_assignable_to(db, KnownClass::Iterable.to_specialized_instance(db, [Type::object(db)])) => t.try_iterate(db).is_ok()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This module contains property tests that currently lead to many false positives.
|
/// This module contains property tests that currently lead to many false positives.
|
||||||
|
@ -227,6 +217,8 @@ mod stable {
|
||||||
mod flaky {
|
mod flaky {
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
|
use crate::types::{KnownClass, Type};
|
||||||
|
|
||||||
use super::{intersection, union};
|
use super::{intersection, union};
|
||||||
|
|
||||||
// Negating `T` twice is equivalent to `T`.
|
// Negating `T` twice is equivalent to `T`.
|
||||||
|
@ -321,4 +313,16 @@ mod flaky {
|
||||||
bottom_materialization_of_type_is_assigneble_to_type, db,
|
bottom_materialization_of_type_is_assigneble_to_type, db,
|
||||||
forall types t. t.bottom_materialization(db).is_assignable_to(db, t)
|
forall types t. t.bottom_materialization(db).is_assignable_to(db, t)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Any type assignable to `Iterable[object]` should be considered iterable.
|
||||||
|
//
|
||||||
|
// Note that the inverse is not true, due to the fact that we recognize the old-style
|
||||||
|
// iteration protocol as well as the new-style iteration protocol: not all objects that
|
||||||
|
// we consider iterable are assignable to `Iterable[object]`.
|
||||||
|
//
|
||||||
|
// Currently flaky due to <https://github.com/astral-sh/ty/issues/889>
|
||||||
|
type_property_test!(
|
||||||
|
all_type_assignable_to_iterable_are_iterable, db,
|
||||||
|
forall types t. t.is_assignable_to(db, KnownClass::Iterable.to_specialized_instance(db, [Type::object(db)])) => t.try_iterate(db).is_ok()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue