mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
21 lines
1 KiB
Python
21 lines
1 KiB
Python
from etl.epc_clean.utils import is_percentage_or_number, correct_spelling
|
|
|
|
|
|
class TestUtils:
|
|
|
|
def test_is_percentage_or_number(self):
|
|
assert is_percentage_or_number("88")
|
|
assert is_percentage_or_number("88%")
|
|
assert not is_percentage_or_number("abc")
|
|
assert not is_percentage_or_number("")
|
|
assert not is_percentage_or_number("88.0") # only integer numbers or percentages
|
|
assert is_percentage_or_number("101%") # numbers over 100 allowed
|
|
assert not is_percentage_or_number("-1") # negative numbers not allowed
|
|
|
|
def test_correct_spelling(self):
|
|
assert correct_spelling("speling") == "spelling"
|
|
assert correct_spelling("88") == "88" # numbers are left unchanged
|
|
assert correct_spelling("corerct") == "correct"
|
|
assert correct_spelling("excllent") == "excellent"
|
|
assert correct_spelling("") == "" # empty string should return an empty string
|
|
assert correct_spelling("88%") == "88%" # percentages are left unchanged
|