Exemple #1
0
 def test_op(self):
     for test in [
         ['0', '=', '0', True],
         ['1', '>', '2', False],
         ['1', '<', '2', True],
         ['1', '>=', '2', False],
         ['1', '=<', '2', True],
     ]:
         e = Expression(test[:3])
         self.assertEqual(test[3], e.parse(None), test)
Exemple #2
0
 def test_basic(self):
     for test in [
         ['0', '+', '0', '0'],
         ['2', '+', '2', '4'],
         ['2.0', '+', '2', '4.0'],
         ['2', '+', '2.0', '4.0'],
         ['2.0', '+', '2.0', '4.0'],
         [('2.0',), '+', '2.0', '4.0'],
         [('2.0',), '+', ('2.0',), '4.0'],
         ['0px', '+', '0', '0'],
         ['2px', '+', '2', '4px'],
         ['2.0px', '+', '2', '4.0px'],
         [('2px', ' '), '+', '2.0', '4.0px'],
         ['2.0px', '+', '2.0', '4.0px'],
                     ]:
         e = Expression(test[:3])
         self.assertEqual(test[3], e.parse(None), str(test))
Exemple #3
0
 def test_basic(self):
     for test in [
         ['0', '+', '0', '0'],
         ['2', '+', '2', '4'],
         ['2.0', '+', '2', '4'],
         ['2', '+', '2.0', '4'],
         ['2.0', '+', '2.0', '4'],
         [('2.0', ), '+', '2.0', '4'],
         [('2.0', ), '+', ('2.0', ), '4'],
         ['0px', '+', '0', '0'],
         ['2px', '+', '2', '4px'],
         ['2.0px', '+', '2', '4px'],
         [('2px', ' '), '+', '2.0', '4px'],
         ['2.0px', '+', '2.0', '4px'],
     ]:
         e = Expression(test[:3])
         self.assertEqual(test[3], e.parse(None), str(test))
Exemple #4
0
 def test_neg(self):
     for test in [
         ['-0', '+', '0', '0'],
         ['-2', '+', '-2', '-4'],
         ['-2.0', '+', '-2', '-4.0'],
         ['-2', '+', '-2.0', '-4.0'],
         ['-2.0', '+', '-2.0', '-4.0'],
         ['-0', '-', '0', '0'],
         ['-2', '-', '-2', '0'],
         ['-2.0', '-', '2', '-4.0'],
         ['-2', '-', '-2.0', '0.0'],
         ['2.0', '-', '-2.0', '4.0'],
         ['-0px', '+', '0', '0'],
         ['-2px', '+', '-2', '-4px'],
         ['-2.0', '+', '-2px', '-4.0px'],
         ['-2em', '+', '-2.0', '-4.0em'],
         ['-2.0s', '+', '-2.0s', '-4.0s'],
     ]:
         e = Expression(test[:3])
         self.assertEqual(test[3], e.parse(None), str(test))
Exemple #5
0
 def test_neg(self):
     for test in [
         ['-0', '+', '0', '0'],
         ['-2', '+', '-2', '-4'],
         ['-2.0', '+', '-2', '-4'],
         ['-2', '+', '-2.0', '-4'],
         ['-2.0', '+', '-2.0', '-4'],
         ['-0', '-', '0', '0'],
         ['-2', '-', '-2', '0'],
         ['-2.0', '-', '2', '-4'],
         ['-2', '-', '-2.0', '0'],
         ['2.0', '-', '-2.0', '4'],
         ['-0px', '+', '0', '0'],
         ['-2px', '+', '-2', '-4px'],
         ['-2.0', '+', '-2px', '-4px'],
         ['-2em', '+', '-2.0', '-4em'],
         ['-2.0s', '+', '-2.0s', '-4s'],
     ]:
         e = Expression(test[:3])
         self.assertEqual(test[3], e.parse(None), str(test))
Exemple #6
0
 def testeq(self):
     for test in [
         ['0', '=', '0', True],
     ]:
         e = Expression(test[:3])
         self.assertEqual(test[3], e.parse(None), test)