-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
37 lines (27 loc) · 1.06 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from specs.helpers import *
from src.amount_reader import AmountReader
import unittest, random
class AmountReaderTest(unittest.TestCase):
def __init__(self, methodName: str) -> None:
self.am = AmountReader()
super().__init__(methodName)
def test_100(self):
self.assertEqual(self.am.t3(100), "một trăm")
def test_000(self):
self.assertEqual(self.am.t3(000), "")
def test_401_and_411(self):
self.assertEqual(self.am.t3(401), "bốn trăm lẻ một")
self.assertEqual(self.am.t3(411), "bốn trăm mười một")
def test_15(self):
self.assertEqual(self.am.t3(15), "mười lăm")
def test_94(self):
self.assertEqual(self.am.t3(94), "chín mươi tư")
def test_25(self):
self.assertEqual(self.am.t3(25), "hai mươi lăm")
def test_4(self):
self.assertEqual(self.am.t3(4), "bốn")
def test_over_3_character(self):
with self.assertRaises(ValueError):
self.am.t3(random.randint(1000,9999))
if __name__ == "__main__":
unittest.main()