Skip to content

Commit 6f65034

Browse files
authored
Merge pull request #325 from ubIQio/byteswaptest
Add test for byteswap
2 parents 442fed0 + fa29c5c commit 6f65034

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

tests/numpy/methods.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,24 @@
4848
print(np.array([1,2,3], dtype=np.int8).tobytes())
4949
print(np.array([1,2,3], dtype=np.float).transpose().shape)
5050
print(np.array([[1],[2],[3]], dtype=np.float).transpose().shape)
51-
51+
a = np.array([1, 2, 3, 4, 5, 6], dtype=np.uint8)
52+
b = a.byteswap(inplace=False)
53+
print(a)
54+
print(b)
55+
c = a.byteswap(inplace=True)
56+
print(a)
57+
print(c)
58+
a = np.array([1, 2, 3, 4, 5, 6], dtype=np.uint16)
59+
b = a.byteswap(inplace=False)
60+
print(a)
61+
print(b)
62+
c = a.byteswap(inplace=True)
63+
print(a)
64+
print(c)
65+
a = np.array([1, 2, 3, 4, 5, 6], dtype=np.float)
66+
b = a.byteswap(inplace=False)
67+
print(a)
68+
print(b)
69+
c = a.byteswap(inplace=True)
70+
print(a)
71+
print(c)

tests/numpy/methods.py.exp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,15 @@ bytearray(b'\x01\x02\x03')
2121
bytearray(b'\x01\x02\x03')
2222
(3,)
2323
(1, 3)
24+
array([1, 2, 3, 4, 5, 6], dtype=uint8)
25+
array([1, 2, 3, 4, 5, 6], dtype=uint8)
26+
array([1, 2, 3, 4, 5, 6], dtype=uint8)
27+
array([1, 2, 3, 4, 5, 6], dtype=uint8)
28+
array([1, 2, 3, 4, 5, 6], dtype=uint16)
29+
array([256, 512, 768, 1024, 1280, 1536], dtype=uint16)
30+
array([256, 512, 768, 1024, 1280, 1536], dtype=uint16)
31+
array([256, 512, 768, 1024, 1280, 1536], dtype=uint16)
32+
array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], dtype=float64)
33+
array([3.038651941617419e-319, 3.162020133383978e-322, 1.043466644016713e-320, 2.055313086699586e-320, 2.561236308041022e-320, 3.067159529382458e-320], dtype=float64)
34+
array([3.038651941617419e-319, 3.162020133383978e-322, 1.043466644016713e-320, 2.055313086699586e-320, 2.561236308041022e-320, 3.067159529382458e-320], dtype=float64)
35+
array([3.038651941617419e-319, 3.162020133383978e-322, 1.043466644016713e-320, 2.055313086699586e-320, 2.561236308041022e-320, 3.067159529382458e-320], dtype=float64)

0 commit comments

Comments
 (0)