Skip to content

Commit dc5dd14

Browse files
committed
Add tests for specific cases
Closes gunthercox/ChatterBot#2256 Closes gunthercox/ChatterBot#1290
1 parent 50f58fc commit dc5dd14

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_replace_word_tokens.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,32 @@ def test_tens_with_and_without_spaces(self):
5252
)
5353
self.assertEqual(result, '19 * (50 + 4)')
5454

55+
def test_tens_with_compound_numbers(self):
56+
result = mathparse.replace_word_tokens(
57+
'ninety seven - 7', language='ENG'
58+
)
59+
self.assertEqual(result, '(90 + 7) - 7')
60+
61+
def test_tens_with_compound_numbers_hyphenated(self):
62+
result = mathparse.replace_word_tokens(
63+
'ninety-seven - 7', language='ENG'
64+
)
65+
self.assertEqual(result, '(90 + 7) - 7')
66+
5567
def test_tens_and_hundreds_with_spaces(self):
5668
result = mathparse.replace_word_tokens(
5769
'one hundred times fifty four', language='ENG'
5870
)
5971
self.assertEqual(result, '(1 * 100) * (50 + 4)')
6072

73+
def test_tens_with_hundreds_multiplier(self):
74+
result = mathparse.replace_word_tokens(
75+
'eighteen hundred and twenty-one',
76+
language='ENG',
77+
stopwords={'and'}
78+
)
79+
self.assertEqual(result, '(18 * 100) + (20 + 1)')
80+
6181
def test_hyphenated_numbers(self):
6282
result = mathparse.replace_word_tokens(
6383
'one hundred times fifty-four', language='ENG'

0 commit comments

Comments
 (0)