예제 #1
0
 def fixed_output_array(self):
     from named_tuple import named_tuple
     # Produce a correct return value
     if self.fixed_output_array_mode==0:
         return named_tuple( ('v', (2,5,7)) )
     # Produce the wrong type
     elif self.fixed_output_array_mode==1:
         return 5
     # Produce a sequence with the wrong number of items
     elif self.fixed_output_array_mode==2:
         return named_tuple( ('v', (2,5)) )
 def fixed_output_array(self):
     from named_tuple import named_tuple
     # Produce a correct return value
     if self.fixed_output_array_mode==0:
         return named_tuple( ('v', (2,5,7)) )
     # Produce the wrong type
     elif self.fixed_output_array_mode==1:
         return 5
     # Produce a sequence with the wrong number of items
     elif self.fixed_output_array_mode==2:
         return named_tuple( ('v', (2,5)) )
예제 #3
0
 def test_named_tuple(self):
   self.assertEqual(
       named_tuple.named_tuple('ID         MARKS      NAME       CLASS    ', [
           '1          97         Raymond    7         ',
           '2          50         Steven     4         ',
           '3          91         Adrian     9         ',
           '4          72         Stewart    5         ',
           '5          80         Peter      6'
       ]), 78)
예제 #4
0
 def test_named_tuple_1(self):
   self.assertEqual(
       named_tuple.named_tuple('MARKS      CLASS      NAME       ID       ', [
           '92         2          Calum      1         ',
           '82         5          Scott      2         ',
           '94         2          Jason      3         ',
           '55         8          Glenn      4         ',
           '82         2          Fergus     5'
       ]), 81)
예제 #5
0
 def get_statistics( self ):
     from named_tuple import named_tuple
     return named_tuple( ( 'x', 2.0 ), ( 'y', 3.0 ) )
 def get_statistics( self ):
     from named_tuple import named_tuple
     return named_tuple( ( 'x', 2.0 ), ( 'y', 3.0 ) )
            def get_statistics(self):
                from named_tuple import named_tuple

                return named_tuple(("x", 2.0), ("y", 3.0))