File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed
Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ def test_registry_basic_operations():
4242
4343 # Test bind with no name
4444 class NoName :
45- pass # pragma: no cover
45+ def __call__ (self ):
46+ pass # pragma: no cover
4647
4748 with pytest .raises (
4849 ValueError ,
@@ -740,8 +741,12 @@ def test_registry_bind_errors():
740741 error1 = ""
741742 error2 = ""
742743
744+ class Callable :
745+ def __call__ (self ):
746+ pass # pragma: no cover
747+
743748 try :
744- reg .bind ()(None ) # Should raise ValueError
749+ reg .bind ()(Callable () ) # Should raise ValueError
745750 except ValueError as e :
746751 error1 = str (e )
747752
Original file line number Diff line number Diff line change @@ -107,8 +107,12 @@ def test_bind_default_object_without_name():
107107 """Test binding an object without name to default registry."""
108108 reg = Registry ()
109109
110+ class Callable :
111+ def __call__ (self ):
112+ pass # pragma: no cover
113+
110114 with pytest .raises (ValueError ) as exc_info :
111- reg .bind_default ()(object ())
115+ reg .bind_default ()(Callable ())
112116 assert "No name provided and object has no __name__ attribute" in str (
113117 exc_info .value
114118 )
Original file line number Diff line number Diff line change @@ -328,8 +328,13 @@ def test_bind_object_without_name():
328328 Test that binding an object without a name and no __name__ attribute
329329 raises ValueError.
330330 """
331+
332+ class Callable :
333+ def __call__ (self ):
334+ pass # pragma: no cover
335+
331336 with pytest .raises (ValueError ) as exc_info :
332- registry .bind ()(object ())
337+ registry .bind ()(Callable ())
333338
334339 assert "No name provided and object has no __name__ attribute" in str (
335340 exc_info .value
@@ -423,7 +428,8 @@ def test_bind_with_invalid_name():
423428 """Test that binding with an invalid name type raises ValueError."""
424429
425430 class TestObject :
426- pass # pragma: no cover
431+ def __call__ (self ):
432+ pass # pragma: no cover
427433
428434 with pytest .raises (ValueError ) as exc_info :
429435 registry .bind ()(TestObject ()) # Pass an object without __name__
You can’t perform that action at this time.
0 commit comments