diff --git a/tests/test_utils_typecast.py b/tests/test_utils_typecast.py index 69937eaa9..6b427c8d2 100644 --- a/tests/test_utils_typecast.py +++ b/tests/test_utils_typecast.py @@ -22,9 +22,6 @@ class Car: def drive(self): return "vroom" - -# --- Tests --- - def test_downcast_success(): d = Dog() downcast(d, Bulldog) @@ -33,7 +30,7 @@ def test_downcast_success(): def test_upcast_success(): b = Bulldog() - assert d.snore() == "woooooof" + assert b.snore() == "woooooof" assert not hasattr(d, "speak") upcast(b, Dog) assert b.speak() == "woof" @@ -43,9 +40,11 @@ def test_upcast_success(): assert b.speak() == "..." def test_downcast_invalid(): - a = Animal() + class C: pass + class D: pass + c = C() with pytest.raises(TypeError, match="is not a subclass"): - downcast(a, Bulldog) + downcast(c, D) def test_upcast_invalid(): c = Car()