Esempio n. 1
0
 def test_format_postcode2(self):
     """ Unit test for formatting of the Postcode
         Checks for special characters in the Postcode and throws an exception
     """
     postcode_inst = PostCodes(10)
     try:
         postcode_inst.format_postcode('PO16 #7GZ')
     except TypeError:
         print("Expected an exception.\n"
               "Postcode contains special character.\n"
               "Test2: Successful")
Esempio n. 2
0
 def test_format_postcode3(self):
     """ Unit test to test formatting of the Postcode
         Checks for length of Postcode and throws an exception
         if the the length doesn't lie between 6 and 8
     """
     postcode_inst = PostCodes(10)
     try:
         postcode_inst.format_postcode('PO167')
     except TypeError:
         print("Expected an exception.\n"
               "Length of the Postcode should be between 6 and 8.\n"
               "Test3: Successful")
Esempio n. 3
0
 def test_format_postcode1(self):
     """ Unit test to test formatting of the Postcode
         Positive case
     """
     postcode_inst = PostCodes(10)
     num = postcode_inst.format_postcode('PO167GZ')
     assert num == 'PO16 7GZ'
     print("Formatted Postcode: " + num + "\nTest1: Successful")