mirror of
https://github.com/wassname/ray.git
synced 2026-07-17 11:32:33 +08:00
Make numpy arrays immutable (#183)
* Make numpy arrays immutable in numbuf * Move break statement outside of brackets * Simplify test case * Simplify test case
This commit is contained in:
committed by
Philipp Moritz
parent
651aa6007a
commit
cac473b557
@@ -118,5 +118,13 @@ class SerializationTests(unittest.TestCase):
|
||||
result = numbuf.deserialize_list(array)
|
||||
assert_equal(result[0], obj)
|
||||
|
||||
def testObjectArrayImmutable(self):
|
||||
obj = np.zeros([10])
|
||||
schema, size, serialized = numbuf.serialize_list([obj])
|
||||
result = numbuf.deserialize_list(serialized)
|
||||
assert_equal(result[0], obj)
|
||||
with self.assertRaises(ValueError):
|
||||
result[0][0] = 1
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
Reference in New Issue
Block a user