mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
add basic check
This commit is contained in:
parent
59b1846dd0
commit
99d1e9b790
1 changed files with 5 additions and 1 deletions
|
|
@ -472,7 +472,9 @@ class EPCRecord:
|
|||
"""
|
||||
Validate a string field
|
||||
"""
|
||||
|
||||
if not isinstance(field_value, str):
|
||||
raise ValueError(f"Field {record_key} has value {field_value} which is not a string")
|
||||
|
||||
if 'function' in validation_config:
|
||||
try:
|
||||
validation_config['function'](field_value)
|
||||
|
|
@ -487,6 +489,8 @@ class EPCRecord:
|
|||
"""
|
||||
Validate a float field
|
||||
"""
|
||||
if not isinstance(field_value, float):
|
||||
raise ValueError(f"Field {record_key} has value {field_value} which is not a float")
|
||||
|
||||
if 'function' in validation_config:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue