mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
[red-knot] Migrate is_equivalent_to
unit tests to Markdown tests (#15470)
## Summary Part of #15397, built on top of #15469. ## Test Plan Markdown tests.
This commit is contained in:
parent
bcf0a715c2
commit
aefb607405
2 changed files with 35 additions and 27 deletions
|
@ -4343,33 +4343,6 @@ pub(crate) mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[test_case(
|
||||
Ty::Union(vec![Ty::IntLiteral(1), Ty::IntLiteral(2)]),
|
||||
Ty::Union(vec![Ty::IntLiteral(1), Ty::IntLiteral(2)])
|
||||
)]
|
||||
#[test_case(Ty::SubclassOfBuiltinClass("object"), Ty::BuiltinInstance("type"))]
|
||||
fn is_equivalent_to(from: Ty, to: Ty) {
|
||||
let db = setup_db();
|
||||
let from = from.into_type(&db);
|
||||
let to = to.into_type(&db);
|
||||
assert!(from.is_equivalent_to(&db, to));
|
||||
assert!(to.is_equivalent_to(&db, from));
|
||||
}
|
||||
|
||||
#[test_case(Ty::Any, Ty::Any)]
|
||||
#[test_case(Ty::Any, Ty::None)]
|
||||
#[test_case(Ty::Unknown, Ty::Unknown)]
|
||||
#[test_case(Ty::Todo, Ty::Todo)]
|
||||
#[test_case(Ty::Union(vec![Ty::IntLiteral(1), Ty::IntLiteral(2)]), Ty::Union(vec![Ty::IntLiteral(1), Ty::IntLiteral(0)]))]
|
||||
#[test_case(Ty::Union(vec![Ty::IntLiteral(1), Ty::IntLiteral(2)]), Ty::Union(vec![Ty::IntLiteral(1), Ty::IntLiteral(2), Ty::IntLiteral(3)]))]
|
||||
fn is_not_equivalent_to(from: Ty, to: Ty) {
|
||||
let db = setup_db();
|
||||
let from = from.into_type(&db);
|
||||
let to = to.into_type(&db);
|
||||
assert!(!from.is_equivalent_to(&db, to));
|
||||
assert!(!to.is_equivalent_to(&db, from));
|
||||
}
|
||||
|
||||
#[test_case(Ty::Never, Ty::Never)]
|
||||
#[test_case(Ty::Never, Ty::None)]
|
||||
#[test_case(Ty::Never, Ty::BuiltinInstance("int"))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue