Python numpy.lib.format.write_array_header_1_0() Examples
The following are 30
code examples of numpy.lib.format.write_array_header_1_0().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy.lib.format
, or try the search function
.
Example #1
Source File: test_format.py From recruit with Apache License 2.0 | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #2
Source File: test_format.py From keras-lambda with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(asbytes('1')) assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(asbytes('\x01\x00')) assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #3
Source File: test_format.py From twitter-stock-recommendation with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #4
Source File: test_format.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #5
Source File: test_format.py From coffeegrindsize with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #6
Source File: test_format.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #7
Source File: test_format.py From ImageFusion with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(asbytes('1')) assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(asbytes('\x01\x00')) assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #8
Source File: test_format.py From mxnet-lambda with Apache License 2.0 | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #9
Source File: test_format.py From pySINDy with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #10
Source File: test_format.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #11
Source File: test_format.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #12
Source File: test_format.py From Computable with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(asbytes('1')) assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(asbytes('\x01\x00')) assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape":(1, 2), "descr":"x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape":(1, 2), "fortran_order":False, "descr":"x", "extrakey":-1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #13
Source File: test_format.py From lambda-packs with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(asbytes('1')) assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(asbytes('\x01\x00')) assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #14
Source File: test_format.py From vnpy_crypto with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #15
Source File: test_format.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(b'1') assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(b'\x01\x00') assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #16
Source File: test_format.py From auto-alt-text-lambda-api with MIT License | 6 votes |
def test_bad_header(): # header of length less than 2 should fail s = BytesIO() assert_raises(ValueError, format.read_array_header_1_0, s) s = BytesIO(asbytes('1')) assert_raises(ValueError, format.read_array_header_1_0, s) # header shorter than indicated size should fail s = BytesIO(asbytes('\x01\x00')) assert_raises(ValueError, format.read_array_header_1_0, s) # headers without the exact keys required should fail d = {"shape": (1, 2), "descr": "x"} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s) d = {"shape": (1, 2), "fortran_order": False, "descr": "x", "extrakey": -1} s = BytesIO() format.write_array_header_1_0(s, d) assert_raises(ValueError, format.read_array_header_1_0, s)
Example #17
Source File: test_format.py From vnpy_crypto with MIT License | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #18
Source File: test_format.py From recruit with Apache License 2.0 | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #19
Source File: test_format.py From keras-lambda with MIT License | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #20
Source File: test_format.py From lambda-packs with MIT License | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #21
Source File: test_format.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #22
Source File: test_format.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #23
Source File: test_format.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #24
Source File: test_format.py From coffeegrindsize with MIT License | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #25
Source File: test_format.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #26
Source File: test_format.py From ImageFusion with MIT License | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #27
Source File: test_format.py From mxnet-lambda with Apache License 2.0 | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #28
Source File: test_format.py From Computable with MIT License | 5 votes |
def test_large_header(): s = BytesIO() d = {'a':1,'b':2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a':1,'b':2,'c':'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #29
Source File: test_format.py From pySINDy with MIT License | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)
Example #30
Source File: test_format.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_large_header(): s = BytesIO() d = {'a': 1, 'b': 2} format.write_array_header_1_0(s, d) s = BytesIO() d = {'a': 1, 'b': 2, 'c': 'x'*256*256} assert_raises(ValueError, format.write_array_header_1_0, s, d)