MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_byteswap

Method test_byteswap

Lib/test/test_array.py:1694–1708  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1692 self.assertIs(a <= b, False)
1693
1694 def test_byteswap(self):
1695 a = array.array(self.typecode, self.example)
1696 self.assertRaises(TypeError, a.byteswap, 42)
1697 if a.itemsize in (1, 2, 4, 8):
1698 b = array.array(self.typecode, self.example)
1699 b.byteswap()
1700 if a.itemsize==1:
1701 self.assertEqual(a, b)
1702 else:
1703 # On alphas treating the byte swapped bit patterns as
1704 # floats/doubles results in floating-point exceptions
1705 # => compare the 8bit string values instead
1706 self.assertNotEqual(a.tobytes(), b.tobytes())
1707 b.byteswap()
1708 self.assertEqual(a, b)
1709
1710class FloatTest(FPTest, unittest.TestCase):
1711 typecode = 'f'

Callers 1

test_byteswapMethod · 0.45

Calls 5

byteswapMethod · 0.80
assertNotEqualMethod · 0.80
assertRaisesMethod · 0.45
assertEqualMethod · 0.45
tobytesMethod · 0.45

Tested by

no test coverage detected