-
Notifications
You must be signed in to change notification settings - Fork 0
/
addr_prep_test.py
42 lines (37 loc) · 1.51 KB
/
addr_prep_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
38
39
40
41
42
#!/usr/bin/python3
"""Unit tests for the addr_prep program.
Usage:
$ python3 addr_prep_test.py
"""
import unittest
import addr_prep
class UnitTestCase(unittest.TestCase):
def setUp(self):
addr_prep.get_conf()
def test_unit_label(self):
label, unit_id = addr_prep.make_addr_unit_and_label('APT', '5')
self.assertEqual(label, 'Apartment')
self.assertEqual(unit_id, '5')
label, unit_id = addr_prep.make_addr_unit_and_label('', 'APT 5')
self.assertEqual(label, 'Apartment')
self.assertEqual(unit_id, '5')
label, unit_id = addr_prep.make_addr_unit_and_label('', 'apt 5')
self.assertEqual(label, 'Apartment')
self.assertEqual(unit_id, '5')
label, unit_id = addr_prep.make_addr_unit_and_label('', 'APT5')
self.assertEqual(label, 'Apartment')
self.assertEqual(unit_id, '5')
label, unit_id = addr_prep.make_addr_unit_and_label('', 'BSMT')
self.assertEqual(label, '')
self.assertEqual(unit_id, 'Basement')
label, unit_id = addr_prep.make_addr_unit_and_label('BSMT', '')
self.assertEqual(label, '')
self.assertEqual(unit_id, 'Basement')
label, unit_id = addr_prep.make_addr_unit_and_label('', '')
self.assertEqual(label, '')
self.assertEqual(unit_id, '')
label, unit_id = addr_prep.make_addr_unit_and_label('UNIT', 'OFC')
self.assertEqual(label, 'Unit')
self.assertEqual(unit_id, 'Office')
if __name__ == '__main__':
unittest.main()