Skip to content

Commit 3203f6d

Browse files
authored
Merge pull request #9 from rolisz/master
RequestModelFactory should look at Config.title attribute
2 parents 32d1785 + ff5ec02 commit 3203f6d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

auto_labeling_pipeline/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def create(cls, model_name: str, attributes: Dict) -> RequestModel:
2525
@classmethod
2626
def find(cls, model_name: str) -> Type[RequestModel]:
2727
for subclass in RequestModel.__subclasses__():
28-
if subclass.__name__ == model_name:
28+
if subclass.Config.title == model_name:
2929
return subclass
3030
raise NameError(f'{model_name} is not found.')
3131

tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_request_model_factory_creates_model_correctly():
1818
type='PLAIN_TEXT',
1919
language='en'
2020
)
21-
model_name = model.__repr_name__()
21+
model_name = model.Config.title
2222
attributes = model.dict()
2323
restored_model = RequestModelFactory.create(model_name, attributes)
2424
assert restored_model == model

0 commit comments

Comments
 (0)