Skip to content

Commit

Permalink
✅ Add tests to cover a wider variety of cases based on the dev set
Browse files Browse the repository at this point in the history
  • Loading branch information
i-be-snek committed Aug 6, 2024
1 parent 7776f5b commit 1d36c6b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_normalize_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def test__preprocess(self, test_input, expected):
("19", [19]),
("$ 355 million", [355000000]),
("5 million", [5000000]),
("100 million", [100000000]),
("13 injuries", [13]),
("£ 23 billion", [23000000000]),
("23 were killed", [23]),
Expand Down Expand Up @@ -170,6 +171,13 @@ def test__extract_simple_range(self, test_input, expected):
("603+", (603, 699, 1)),
(">=293", (293, 299, 1)),
("~293", (278, 307, 1)),
(">= $27 million", (27000000, 29999999, 1)),
("$27 million or more", (27000000, 29999999, 1)),
("about A$500 million", (475000000, 525000000, 1)),
("over US$500 million", (500000001, 599999999, 1)),
("over USD 1.0 billion", (1000000001, 1999999999, 1)),
("15 billion yuan", (15000000000, 15000000000, 0)),
("100 million pesos", (100000000, 100000000, 0)),
],
)
def test_extract_numbers(self, test_input, expected):
Expand Down Expand Up @@ -220,6 +228,8 @@ def test__extract_approximate_quantifiers(self, test_input, expected):
(">=5", (5, 10)), # created range by adding 5 since scale == 1
("greater than or equal to 9", (9, 14)), # created range by adding 5 since scale == 1
("45+ deaths were reported by the news", (45, 49)),
("311,000,000+ Euros", (311000000, 399999999)),
(">693 million", (693000001, 699999999)),
# under
("less than 230000000 dollars were paid out in insurance costs", (200000001, 229999999)),
("No more than 23 million dollars", (20000001, 23000000)),
Expand Down

0 comments on commit 1d36c6b

Please sign in to comment.