-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
101 lines (67 loc) · 3.13 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 20 19:42:37 2018
@author: thayssilva
"""
import unittest
from printMultiples import multiples,RangeIntervals
from codeValidation import Inwardcode,OutwardCode,ValidatePostcode
class TestUnit(unittest.TestCase):
def setUp(self):
pass
#Test Multiples Print
def test1_numbers_3_print_Three(self):
self.assertEqual( multiples(9), "Three")
def test2_numbers_3_print_Five(self):
self.assertEqual( multiples(5), 'Five')
def test3_numbers_3and5_print_ThreeFive(self):
self.assertEqual( multiples(45), "ThreeFive")
def test4_numbers_NOT3and5_print_number(self):
self.assertEqual( multiples(13),13)
#Test Postcode Inwardcode
def test1_Inwardcode_accept(self):
self.assertEqual( Inwardcode("1BT"), True)
def test2_Inwardcode_refuse(self):
self.assertEqual( Inwardcode("1OT"), False)
def test3_Inwardcode_refuse(self):
self.assertEqual( Inwardcode("13T"), False)
#Test Postcode OutwardCode
def test5_OutwardCode_accept_2Digits(self):
self.assertEqual( OutwardCode("B1"), True)
def test6_OutwardCode_refuse_2Digits(self):
self.assertEqual( OutwardCode("1V"), False)
def test7_OutwardCode_accept_A99(self):
self.assertEqual( OutwardCode("B32"), True)
def test8_OutwardCode_refuse_A99(self):
self.assertEqual( OutwardCode("X99"), False)
def test9_OutwardCode_accept_A9A(self):
self.assertEqual( OutwardCode("B3C"), True)
def test10_OutwardCode_refuse_A9A(self):
self.assertEqual( OutwardCode("B3R"), False)
def test11_OutwardCode_accept_AA99(self):
self.assertEqual( OutwardCode("AL21"), True)
def test12_OutwardCode_refuse_AA99(self):
self.assertEqual( OutwardCode("AZ21"), False)
def test13_OutwardCode_accept_AA9A(self):
self.assertEqual( OutwardCode("AL2M"), True)
def test14_OutwardCode_refuse_AA9A(self):
self.assertEqual( OutwardCode("AL2C"), False)
def test15_ValidatePostcode_accept(self):
self.assertEqual( ValidatePostcode("CH65 9AS"), True)
def test16_ValidatePostcode_accept(self):
self.assertEqual( ValidatePostcode("B37 7JS"), True)
def test17_ValidatePostcode_accept(self):
self.assertEqual( ValidatePostcode("NE47 6LW"), True)
def test18_ValidatePostcode_refuse(self):
self.assertEqual( ValidatePostcode("XE47 6LW"), False)
def test19_ValidatePostcode_refuse(self):
self.assertEqual( ValidatePostcode("XE47 6LO"), False)
def test20_ValidatePostcode_refuse_Formating(self):
self.assertEqual(ValidatePostcode("XE476LO"), "Postcode invalid format")
def test21_ValidatePostcode_refuse_Formating(self):
self.assertEqual(ValidatePostcode("XE"), "Postcode invalid format")
def test22_OutwardCode_refuse_Formating(self):
self.assertEqual( ValidatePostcode("XE47 6L%"), "Postcode does not accept special character")
if __name__ == '__main__':
unittest.main()