예제 #1
0
def test_get_output():
    f = np.arange(256).reshape((32,8))
    output = _get_output(f, None, 'test')
    assert output.dtype == f.dtype
    assert output.shape == f.shape
    out2 = _get_output(f, output, 'test')
    assert out2 is output
def test_get_output_non_contiguous():
    f = np.arange(256).reshape((32, 8))
    output = np.zeros((32, 16), f.dtype)
    output = output[:, ::2]
    assert output.shape == f.shape
    with pytest.raises(ValueError):
        _get_output(f, output, 'testing')
예제 #3
0
def test_get_output():
    f = np.arange(256).reshape((32,8))
    output = _get_output(f, None, 'test')
    assert output.dtype == f.dtype
    assert output.shape == f.shape
    out2 = _get_output(f, output, 'test')
    assert out2 is output
예제 #4
0
def test_get_output_explicit_dtype():
    f = np.arange(256).reshape((32,8))
    output = np.zeros_like(f)
    _get_output(f, output, 'testing', bool)
예제 #5
0
def test_get_output_non_contiguous():
    f = np.arange(256).reshape((32,8))
    output = np.zeros((32,16), f.dtype)
    output = output[:,::2]
    assert output.shape == f.shape
    _get_output(f, output, 'testing')
예제 #6
0
def test_get_output_bad_shape():
    f = np.arange(256).reshape((32,8))
    output = np.zeros((16,16), f.dtype)
    _get_output(f, output, 'testing')
예제 #7
0
def test_dtype():
    f = np.arange(256).reshape((32,8))
    output = _get_output(f, None, 'test', np.float32)
    assert output.dtype == np.float32
예제 #8
0
def test_get_output_explicit_dtype():
    f = np.arange(256).reshape((32,8))
    output = np.zeros_like(f)
    _get_output(f, output, 'testing', bool)
예제 #9
0
def test_get_output_bad_shape():
    f = np.arange(256).reshape((32,8))
    output = np.zeros((16,16), f.dtype)
    _get_output(f, output, 'testing')
예제 #10
0
def test_dtype():
    f = np.arange(256).reshape((32,8))
    output = _get_output(f, None, 'test', np.float32)
    assert output.dtype == np.float32
def test_get_output_explicit_dtype():
    f = np.arange(256).reshape((32, 8))
    output = np.zeros_like(f)
    with pytest.raises(ValueError):
        _get_output(f, output, 'testing', bool)
def test_get_output_bad_shape():
    f = np.arange(256).reshape((32, 8))
    output = np.zeros((16, 16), f.dtype)
    with pytest.raises(ValueError):
        _get_output(f, output, 'testing')