예제 #1
0
 def test_compare_different(self):
     # object comparison is consistent
     obj1, obj2 = sorted(
         [_test_pytalloc.base_new(),
          _test_pytalloc.base_new()])
     self.assertFalse(obj1 == obj2)
     self.assertTrue(obj1 != obj2)
     self.assertTrue(obj1 <= obj2)
     self.assertTrue(obj1 < obj2)
     self.assertFalse(obj1 >= obj2)
     self.assertFalse(obj1 > obj2)
예제 #2
0
 def test_compare_different(self):
     # object comparison is consistent
     obj1, obj2 = sorted([
         _test_pytalloc.base_new(),
         _test_pytalloc.base_new()])
     self.assertFalse(obj1 == obj2)
     self.assertTrue(obj1 != obj2)
     self.assertTrue(obj1 <= obj2)
     self.assertTrue(obj1 < obj2)
     self.assertFalse(obj1 >= obj2)
     self.assertFalse(obj1 > obj2)
예제 #3
0
 def test_compare_different_types(self):
     # object comparison falls back to comparing types
     if sys.version_info >= (3, 0):
         # In Python 3, types are unorderable -- nothing to test
         return
     if talloc.BaseObject < _test_pytalloc.DBaseObject:
         obj1 = _test_pytalloc.base_new()
         obj2 = _test_pytalloc.DBaseObject(dummy_func)
     else:
         obj2 = _test_pytalloc.base_new()
         obj1 = _test_pytalloc.DBaseObject(dummy_func)
     self.assertFalse(obj1 == obj2)
     self.assertTrue(obj1 != obj2)
     self.assertTrue(obj1 <= obj2)
     self.assertTrue(obj1 < obj2)
     self.assertFalse(obj1 >= obj2)
     self.assertFalse(obj1 > obj2)
예제 #4
0
 def test_compare_same(self):
     obj1 = _test_pytalloc.base_new()
     self.assertTrue(obj1 == obj1)
     self.assertFalse(obj1 != obj1)
     self.assertTrue(obj1 <= obj1)
     self.assertFalse(obj1 < obj1)
     self.assertTrue(obj1 >= obj1)
     self.assertFalse(obj1 > obj1)
예제 #5
0
 def test_compare_different_types(self):
     # object comparison falls back to comparing types
     if sys.version_info >= (3, 0):
         # In Python 3, types are unorderable -- nothing to test
         return
     if talloc.BaseObject < _test_pytalloc.DBaseObject:
         obj1 = _test_pytalloc.base_new()
         obj2 = _test_pytalloc.DBaseObject(dummy_func)
     else:
         obj2 = _test_pytalloc.base_new()
         obj1 = _test_pytalloc.DBaseObject(dummy_func)
     self.assertFalse(obj1 == obj2)
     self.assertTrue(obj1 != obj2)
     self.assertTrue(obj1 <= obj2)
     self.assertTrue(obj1 < obj2)
     self.assertFalse(obj1 >= obj2)
     self.assertFalse(obj1 > obj2)
예제 #6
0
 def test_compare_same(self):
     obj1 = _test_pytalloc.base_new()
     self.assertTrue(obj1 == obj1)
     self.assertFalse(obj1 != obj1)
     self.assertTrue(obj1 <= obj1)
     self.assertFalse(obj1 < obj1)
     self.assertTrue(obj1 >= obj1)
     self.assertFalse(obj1 > obj1)
예제 #7
0
 def test_base_repr(self):
     obj = _test_pytalloc.base_new()
     prefix = '<talloc.BaseObject talloc based object at'
     self.assertTrue(repr(obj).startswith(prefix))
     self.assertEqual(repr(obj), str(obj))
예제 #8
0
 def test_base_repr(self):
     obj = _test_pytalloc.base_new()
     prefix = '<talloc.BaseObject talloc based object at'
     self.assertTrue(repr(obj).startswith(prefix))
     self.assertEqual(repr(obj), str(obj))