Commit 0b49ba68 authored by Tres Seaver's avatar Tres Seaver

Moar tests for lying about '__class__' in pure Python.

parent 98c51eb5
...@@ -492,7 +492,8 @@ class PyProxyBaseTestCase(unittest.TestCase): ...@@ -492,7 +492,8 @@ class PyProxyBaseTestCase(unittest.TestCase):
x = self._makeOne(1) x = self._makeOne(1)
y = self._makeOne(2.1) y = self._makeOne(2.1)
a, b = coerce(x, y) a, b = coerce(x, y)
self.assertFalse(a is x) # a was coerced self.assertTrue(isinstance(a, float)) # a was coerced
self.assertFalse(a is x)
self.assertEqual(a, float(x)) self.assertEqual(a, float(x))
self.assertTrue(b is y) self.assertTrue(b is y)
...@@ -500,7 +501,8 @@ class PyProxyBaseTestCase(unittest.TestCase): ...@@ -500,7 +501,8 @@ class PyProxyBaseTestCase(unittest.TestCase):
y = self._makeOne(2) y = self._makeOne(2)
a, b = coerce(x, y) a, b = coerce(x, y)
self.assertTrue(a is x) self.assertTrue(a is x)
self.assertFalse(b is y) # b was coerced self.assertTrue(isinstance(b, float)) # b was coerced
self.assertFalse(b is y)
self.assertEqual(b, float(y)) self.assertEqual(b, float(y))
x = self._makeOne(1) x = self._makeOne(1)
...@@ -512,7 +514,8 @@ class PyProxyBaseTestCase(unittest.TestCase): ...@@ -512,7 +514,8 @@ class PyProxyBaseTestCase(unittest.TestCase):
x = self._makeOne(1) x = self._makeOne(1)
y = 2.1 y = 2.1
a, b = coerce(x, y) a, b = coerce(x, y)
self.assertFalse(a is x) # a was coerced self.assertTrue(isinstance(a, float)) # a was coerced
self.assertFalse(a is x)
self.assertEqual(a, float(x)) self.assertEqual(a, float(x))
self.assertTrue(b is y) self.assertTrue(b is y)
...@@ -520,7 +523,8 @@ class PyProxyBaseTestCase(unittest.TestCase): ...@@ -520,7 +523,8 @@ class PyProxyBaseTestCase(unittest.TestCase):
y = 2 y = 2
a, b = coerce(x, y) a, b = coerce(x, y)
self.assertTrue(a is x) self.assertTrue(a is x)
self.assertFalse(b is y) # b was coerced self.assertTrue(isinstance(b, float)) # b was coerced
self.assertFalse(b is y)
self.assertEqual(b, float(y)) self.assertEqual(b, float(y))
x = 1 x = 1
...@@ -533,13 +537,15 @@ class PyProxyBaseTestCase(unittest.TestCase): ...@@ -533,13 +537,15 @@ class PyProxyBaseTestCase(unittest.TestCase):
y = self._makeOne(2) y = self._makeOne(2)
a, b = coerce(x, y) a, b = coerce(x, y)
self.assertTrue(a is x) self.assertTrue(a is x)
self.assertFalse(b is y) # b was coerced self.assertTrue(isinstance(b, float)) # b was coerced
self.assertFalse(b is y)
self.assertEqual(b, float(y)) self.assertEqual(b, float(y))
x = 1 x = 1
y = self._makeOne(2.1) y = self._makeOne(2.1)
a, b = coerce(x, y) a, b = coerce(x, y)
self.assertFalse(a is x) # a was coerced self.assertTrue(isinstance(a, float)) # a was coerced
self.assertFalse(a is x)
self.assertEqual(a, float(x)) self.assertEqual(a, float(x))
self.assertTrue(b is y) self.assertTrue(b is y)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment