Ejemplo n.º 1
0
    def assert_to_tuples(self, data):
        for input, expected in data:
            pathData = PathDataParser()
            actual = pathData.to_tuples(input)
            self.assertEquals(actual, expected, 'for %r' % (input,))

            # test types of int/floats too. assertEquals doesn't
            for actual_cmd, exp_cmd in zip(actual, expected):
                for actual_param, exp_param in zip(actual_cmd, exp_cmd):
                    self.assertEquals(
                        type(actual_param),
                        type(exp_param),
                        'for %r' % (input,))
Ejemplo n.º 2
0
 def test_to_tuples_typical(self):
     data = [
         ' M 1, 2 L 3.0, 4.0 L 5, 6.0 Z ',
         'M 1, 2 L 3.0, 4.0 L 5, 6.0 Z',
         'M 1,2 L 3.0,4.0 L 5,6.0 Z',
         'M 1 2 L 3.0 4.0 L 5 6.0 Z',
         'M1, 2 L3.0, 4.0 L5, 6.0 Z',
         'M1,2 L3.0,4.0 L5,6.0 Z',
         'M1 2 L3.0 4.0 L5 6.0 Z',
         'M 1, 2L 3.0, 4.0L 5, 6.0Z',
         'M 1,2L 3.0,4.0L 5,6.0Z',
         'M 1 2L 3.0 4.0L 5 6.0Z',
         'M1, 2L3.0, 4.0L5, 6.0Z',
         'M1,2L3.0,4.0L5,6.0Z',
         'M1 2L3.0 4.0L5 6.0Z',
     ]
     expected = [ ('M', 1, 2), ('L', 3.0, 4.0), ('L', 5, 6.0), ('Z',)]
     for input in data:
         pathData = PathDataParser()
         actual = pathData.to_tuples(input)
         self.assertEquals(actual, expected, 'for %s' % (input,))