Ejemplo n.º 1
0
    def testConversionOperator(self):
        '''Time defined an conversion operator for Str, so passing a Time object to a method expecting a Str should work.'''
        t = Time(1, 2, 3)
        t_str = t.toString()
        sl = StrList()

        # StrList.append expects a Str object.
        sl.append(t)

        self.assertEqual(len(sl), 1)
        self.assertEqual(sl[0], t_str)
Ejemplo n.º 2
0
 def testSimpleMethodWithTwoParamers(self):
     '''Simple method with 2 parameters: Time.setTime(int h, int m, int s = 0, int ms = 0)'''
     time = Time()
     time.setTime(1, 2)
     self.assertTrue(time.toString(), '01:02:00.000')
Ejemplo n.º 3
0
 def testSimpleMethodWithAllParamers(self):
     '''Simple method with all parameters: Time.setTime(int h, int m, int s = 0, int ms = 0)'''
     time = Time()
     time.setTime(1, 2, 3, 4)
     self.assertTrue(time.toString(), '01:02:03.004')
Ejemplo n.º 4
0
 def testConstructorWithTwoParamers(self):
     '''Constructor with 2 parameters: Time(int h, int m, int s = 0, int ms = 0)'''
     time = Time(1, 2)
     self.assertTrue(time.toString(), '01:02:00.000')
Ejemplo n.º 5
0
 def testConstructorWithAllParamers(self):
     '''Constructor with all parameters: Time(int h, int m, int s = 0, int ms = 0)'''
     time = Time(1, 2, 3, 4)
     self.assertTrue(time.toString(), '01:02:03.004')
Ejemplo n.º 6
0
 def testConstructorWithAllParamers(self):
     '''Constructor with all parameters: Time(int h, int m, int s = 0, int ms = 0)'''
     time = Time(1, 2, 3, 4)
     self.assertTrue(time.toString(), '01:02:03.004')