from typing import List, Tuple
from spock import SpockBuilder
from spock.config import spock
@spock
class TypeConfig:
param: Tuple[List[str], List[str]] = ([],[])
config = SpockBuilder(TypeConfig).generate()
usage: spocktest.py -c [--config] config1 [config2, config3, ...]
configuration(s):
TypeConfig
param Tuple[List[str], List[str]] (default: ([], []))
Spock class `TypeConfig` could not be instantiated -- attrs message: Subscripted generics cannot be used with class and instance checks
Traceback (most recent call last):
File "[...]/lib/python3.10/site-packages/spock/backend/field_handlers.py", line 878, in recurse_generate
spock_instance = spock_cls(**fields)
File "<attrs generated init spock.backend.config.TypeConfig>", line 6, in __init__
File "[...]/lib/python3.10/site-packages/attr/validators.py", line 388, in __call__
self.member_validator(inst, attr, member)
File "[...]/lib/python3.10/site-packages/attr/validators.py", line 102, in __call__
if not isinstance(value, self.type):
File "[...]/lib/python3.10/typing.py", line 994, in __instancecheck__
return self.__subclasscheck__(type(obj))
File "[...]/lib/python3.10/typing.py", line 997, in __subclasscheck__
raise TypeError("Subscripted generics cannot be used with"
TypeError: Subscripted generics cannot be used with class and instance checks
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "[...]/spocktest.py", line 11, in <module>
config = SpockBuilder(TypeConfig).generate()
File "[...]/lib/python3.10/site-packages/spock/builder.py", line 150, in __init__
raise e
File "[...]/lib/python3.10/site-packages/spock/builder.py", line 134, in __init__
self._arg_namespace = self._builder_obj.generate(self._dict_args)
File "[...]/lib/python3.10/site-packages/spock/backend/builder.py", line 138, in generate
spock_space_kwargs = self.resolve_spock_space_kwargs(self._graph, dict_args)
File "[...]/lib/python3.10/site-packages/spock/backend/builder.py", line 160, in resolve_spock_space_kwargs
spock_instance, special_keys = RegisterSpockCls.recurse_generate(
File "[...]/lib/python3.10/site-packages/spock/backend/field_handlers.py", line 880, in recurse_generate
raise _SpockInstantiationError(
spock.exceptions._SpockInstantiationError: Spock class `TypeConfig` could not be instantiated -- attrs message: Subscripted generics cannot be used with class and instance checks