File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 11import inspect
22from typing import Any
3- from test .models ._models import get_unimplemented_models
3+
4+ import _models # type: ignore # did not set types for this
45import tableauserverclient as TSC
56
67import pytest
@@ -45,4 +46,18 @@ def try_instantiate_class(name: str, obj: Any) -> Any | None:
4546 return instance
4647 else :
4748 print (f"Class '{ name } ' does not have a constructor (__init__ method)." )
48- return None
49+
50+
51+ def is_concrete (obj : Any ):
52+ return inspect .isclass (obj ) and not inspect .isabstract (obj )
53+
54+
55+ @pytest .mark .parametrize ("class_name, obj" , inspect .getmembers (TSC , is_concrete ))
56+ def test_by_reflection (class_name , obj ):
57+ instantiate_class (class_name , obj )
58+
59+
60+ @pytest .mark .parametrize ("model" , _models .get_defined_models ())
61+ def test_repr_is_implemented (model ):
62+ print (model .__name__ , type (model .__repr__ ).__name__ )
63+ assert type (model .__repr__ ).__name__ == "function"
You can’t perform that action at this time.
0 commit comments