Example #1
0
 def test_add(self):
     self.assertEqual(Constraints() + '>1', Constraints.parse('>1'))
     self.assertEqual(Constraints() + Constraints.parse('>1'),
                      Constraints.parse('>1'))
     self.assertEqual(Constraints() + Constraint.parse('>1'),
                      Constraints.parse('>1'))
     self.assertRaises(TypeError, Constraints().__add__, 42)
Example #2
0
 def test_add(self):
     self.assertEqual(Constraint.parse(">1") + "<2", Constraints.parse(">1,<2"))
Example #3
0
 def test_match(self):
     self.assertTrue(Constraints.parse('>1,<2').match('1.5'))
Example #4
0
 def test_eq_invalid_constraints_str(self):
     self.assertFalse(Constraints() == '#@$!')
Example #5
0
 def test_repr(self):
     self.assertEqual(repr(Constraints()), "Constraints()")
     self.assertEqual(repr(Constraints.parse('==1')),
                      "Constraints.parse('==1.0.0')")
Example #6
0
 def test_str(self):
     self.assertEqual(str(Constraints([Constraint.parse('>1'),
                                       Constraint.parse('<2')])),
                      '>1.0.0,<2.0.0')
Example #7
0
 def test_iadd(self):
     constraints = Constraints()
     constraints += '>1'
     self.assertEqual(constraints, Constraints.parse('>1'))
Example #8
0
 def test_parse(self):
     constraints = Constraints.parse('>1,<2')
Example #9
0
 def test_match_in(self):
     self.assertTrue('1.5' in Constraints.parse('>1,<2'))
Example #10
0
 def test_add(self):
     self.assertEqual(
         Constraint.parse('>1') + '<2', Constraints.parse('>1,<2'))