コード例 #1
0
ファイル: test_internal.py プロジェクト: Tfou57/robomow
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
コード例 #2
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
    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
ファイル: test_internal.py プロジェクト: Tfou57/robomow
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
ファイル: test_internal.py プロジェクト: Tfou57/robomow
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
ファイル: test_internal.py プロジェクト: Tfou57/robomow
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
ファイル: test_internal.py プロジェクト: Tfou57/robomow
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
コード例 #11
0
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)
コード例 #12
0
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')