Commit c0d1d808 authored by Mikhail Karnevskiy's avatar Mikhail Karnevskiy
Browse files

improve type check

parent b7c15087
Pipeline #3386 passed with stage
in 53 seconds
......@@ -55,7 +55,7 @@ def check_type(obj):
for attribute in attr.fields(type(obj)):
expected_type = get_config_entry_option(attribute, 'type')
variable = getattr(obj, attribute.name)
if expected_type != type(variable):
if not isinstance(variable, expected_type):
raise TypeError("Variable '{}' has wrong type '{}', expected '{}'".format(attribute.name,
type(variable),
expected_type))
......
......@@ -12,7 +12,7 @@ class DummySimpleWorker(SimpleWorker):
@Configurable
class Parameters:
path = Config("Path to something",
type=pathlib.PosixPath, converter=Path)
type=Path, converter=Path)
n = Config("Number of something",
type=int)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment