Skip to content

Commit 113a0a2

Browse files
committed
Config hotfix 2 (#16)
* Allow new attributes for general config * Allow new attributes for NER config * Update test for disallowed new values
1 parent 3f5e91f commit 113a0a2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

medcat-v2/medcat/config/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ class General(SerialisableBaseModel):
247247
NOTE: While using a simple hash is faster at save time, it is less
248248
reliable due to not taking into account all the details of the changes."""
249249

250+
class Config:
251+
extra = 'allow'
252+
250253

251254
class LinkingFilters(SerialisableBaseModel):
252255
"""These describe the linking filters used alongside the model.
@@ -431,6 +434,9 @@ class Ner(ComponentConfig):
431434
custom_cnf: Optional[Any] = None
432435
"""The custom config for the component."""
433436

437+
class Config:
438+
extra = 'allow'
439+
434440

435441
class AnnotationOutput(SerialisableBaseModel):
436442
"""The annotation output part of the config"""

medcat-v2/tests/config/test_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ConfigTests(unittest.TestCase):
3535
}
3636
}
3737
}
38-
NEW_KEY_PATH_INCORRECT = 'general.this_key_is_new_woo'
38+
NEW_KEY_PATH_INCORRECT = 'cdb_maker.this_key_is_new_woo'
3939
TO_MERGE_NEW_KEY_INCORRECT = {
4040
NEW_KEY_PATH_INCORRECT.split(".")[0]: {
4141
NEW_KEY_PATH_INCORRECT.split(".")[1]: TO_MERGE_NEW_VAL,
@@ -68,7 +68,7 @@ def test_can_merge_new_value_where_allowed(self):
6868
cur = getattr(cur, path)
6969
self.assertEqual(cur, self.TO_MERGE_NEW_VAL)
7070

71-
def test_cannot_mege_new_value_not_allowed(self):
71+
def test_cannot_merge_new_value_not_allowed(self):
7272
with self.assertRaises(config.IncorrectConfigValues):
7373
self.cnf.merge_config(self.TO_MERGE_NEW_KEY_INCORRECT)
7474

0 commit comments

Comments
 (0)