Ejemplo n.º 1
0
class TestConvert(unittest.TestCase):
    def test_Correct_A(self):
        self.convert_amount = Main_Function_Call('123456.78')
        self.assertEqual(
            self.convert_amount.convert(),
            "Rs. One Lakh Twenty Three Thousand Four Hundred and Fifty Six 78/100 ONLY"
        )

    def test_ToFloat(self):
        attr = Attrs('2340')
        self.assertIsInstance(attr.num_str, str)
        self.assertIsInstance(attr.num_list, list)
        self.assertIsInstance(attr.amount, int)

    def test_Zero(self):
        self.convert_amount = Main_Function_Call('0')
        self.assertEqual(self.convert_amount.convert(), "Rs. Zero")

    def test_InvalidCharacter(self):
        self.convert_amount = Main_Function_Call('sdd')
        self.assertEqual(self.convert_amount.convert(),
                         "sdd contains invalid input character")

    def test_NumberOfDots(self):
        self.convert_amount = Main_Function_Call('34.56.34')
        self.assertEqual(self.convert_amount.convert(),
                         "34.56.34 contains invalid input character")

    def test_DecimalLimit(self):
        self.convert_amount = Main_Function_Call('234.5436')
        self.assertEqual(self.convert_amount.convert(),
                         "234.5436 contains invalid input character")

    def test_StartWithDigit(self):
        self.convert_amount = Main_Function_Call('.05')
        self.assertEqual(self.convert_amount.convert(),
                         ".05 contains invalid input character")

    def test_EndWithDigit(self):
        self.convert_amount = Main_Function_Call('0.3a')
        self.assertEqual(self.convert_amount.convert(),
                         "0.3a contains invalid input character")

    def test_Limit(self):
        self.convert_amount = Main_Function_Call('9999789')
        self.assertEqual(self.convert_amount.convert(),
                         "9999789 is not in between 0 and 999999.99")
Ejemplo n.º 2
0
 def test_Correct_A(self):
     self.convert_amount = Main_Function_Call('123456.78')
     self.assertEqual(
         self.convert_amount.convert(),
         "Rs. One Lakh Twenty Three Thousand Four Hundred and Fifty Six 78/100 ONLY"
     )
Ejemplo n.º 3
0
 def test_EndWithDigit(self):
     self.convert_amount = Main_Function_Call('0.3a')
     self.assertEqual(self.convert_amount.convert(),
                      "0.3a contains invalid input character")
Ejemplo n.º 4
0
 def test_Limit(self):
     self.convert_amount = Main_Function_Call('9999789')
     self.assertEqual(self.convert_amount.convert(),
                      "9999789 is not in between 0 and 999999.99")
Ejemplo n.º 5
0
 def test_StartWithDigit(self):
     self.convert_amount = Main_Function_Call('.05')
     self.assertEqual(self.convert_amount.convert(),
                      ".05 contains invalid input character")
Ejemplo n.º 6
0
 def test_DecimalLimit(self):
     self.convert_amount = Main_Function_Call('234.5436')
     self.assertEqual(self.convert_amount.convert(),
                      "234.5436 contains invalid input character")
Ejemplo n.º 7
0
 def test_NumberOfDots(self):
     self.convert_amount = Main_Function_Call('34.56.34')
     self.assertEqual(self.convert_amount.convert(),
                      "34.56.34 contains invalid input character")
Ejemplo n.º 8
0
 def test_InvalidCharacter(self):
     self.convert_amount = Main_Function_Call('sdd')
     self.assertEqual(self.convert_amount.convert(),
                      "sdd contains invalid input character")
Ejemplo n.º 9
0
 def test_Zero(self):
     self.convert_amount = Main_Function_Call('0')
     self.assertEqual(self.convert_amount.convert(), "Rs. Zero")