SF patch #670423: Add missing identity tests to operator.c

This commit is contained in:
Raymond Hettinger 2003-01-18 23:22:20 +00:00
parent 18acea7c8e
commit 9543b34006
4 changed files with 49 additions and 3 deletions

View file

@ -215,6 +215,17 @@ class OperatorTestCase(unittest.TestCase):
def test_bitwise_xor(self):
self.failUnless(operator.xor(0xb, 0xc) == 0x7)
def test_is(self):
a = b = 'xyzpdq'
c = a[:3] + b[3:]
self.failUnless(operator.is_(a, b))
self.failIf(operator.is_(a,c))
def test_is_not(self):
a = b = 'xyzpdq'
c = a[:3] + b[3:]
self.failIf(operator.is_not(a, b))
self.failUnless(operator.is_not(a,c))
def test_main():
test_support.run_unittest(OperatorTestCase)