Ejemplo n.º 1
0
 def test_compare_different(self):
     # object comparison is consistent
     obj1, obj2 = sorted([_test_pytalloc.new(), _test_pytalloc.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)
Ejemplo n.º 2
0
 def test_compare_different(self):
     # object comparison is consistent
     obj1, obj2 = sorted([
         _test_pytalloc.new(),
         _test_pytalloc.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)
Ejemplo n.º 3
0
 def test_compare_different_types(self):
     # object comparison falls back to comparing types
     if talloc.Object < _test_pytalloc.DObject:
         obj1 = _test_pytalloc.new()
         obj2 = _test_pytalloc.DObject(dummy_func)
     else:
         obj2 = _test_pytalloc.new()
         obj1 = _test_pytalloc.DObject(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)
Ejemplo n.º 4
0
 def test_compare_different_types(self):
     # object comparison falls back to comparing types
     if talloc.Object < _test_pytalloc.DObject:
         obj1 = _test_pytalloc.new()
         obj2 = _test_pytalloc.DObject(dummy_func)
     else:
         obj2 = _test_pytalloc.new()
         obj1 = _test_pytalloc.DObject(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)
Ejemplo n.º 5
0
 def test_compare_same(self):
     obj1 = _test_pytalloc.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)
Ejemplo n.º 6
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.Object < _test_pytalloc.DObject:
         obj1 = _test_pytalloc.new()
         obj2 = _test_pytalloc.DObject(dummy_func)
     else:
         obj2 = _test_pytalloc.new()
         obj1 = _test_pytalloc.DObject(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)
Ejemplo n.º 7
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.Object < _test_pytalloc.DObject:
         obj1 = _test_pytalloc.new()
         obj2 = _test_pytalloc.DObject(dummy_func)
     else:
         obj2 = _test_pytalloc.new()
         obj1 = _test_pytalloc.DObject(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)
Ejemplo n.º 8
0
 def test_compare_same(self):
     obj1 = _test_pytalloc.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)
Ejemplo n.º 9
0
 def test_repr(self):
     obj = _test_pytalloc.new()
     prefix = '<talloc.Object talloc object at'
     self.assertTrue(repr(obj).startswith(prefix))
     self.assertEqual(repr(obj), str(obj))
Ejemplo n.º 10
0
 def test_totalblocks(self):
     obj = _test_pytalloc.new()
     # Two blocks: the string, and the name
     self.assertEqual(talloc.total_blocks(obj), 2)
Ejemplo n.º 11
0
 def test_repr(self):
     obj = _test_pytalloc.new()
     prefix = '<talloc.Object talloc object at'
     self.assertTrue(repr(obj).startswith(prefix))
     self.assertEqual(repr(obj), str(obj))
Ejemplo n.º 12
0
 def test_totalblocks(self):
     obj = _test_pytalloc.new()
     # Two blocks: the string, and the name
     self.assertEqual(talloc.total_blocks(obj), 2)