def test_overlay_array(): plot = Plot() lst = [1, 2, 3] plot.overlay_array(lst) assert plot.command_and_arguments == { 'command': 'overlay_array', 'arguments': [memoryview(np.array(lst, dtype=np.float32))], }
def test_overlay_array_numpy(): plot = Plot() lst = np.array([1, 2, 3]) plot.overlay_array(lst) assert plot.command_and_arguments == { 'command': 'overlay_array', 'arguments': [memoryview(lst.astype(np.float32))], }
def test_overlay_array_bad_type(): plot = Plot() lst = ['foo', 'bar', 'baz'] with pytest.raises(TypeError): plot.overlay_array(lst)
def test_overlay_array_numpy_bad_dtype(): plot = Plot() lst = np.array(['foo', 'bar', 'baz']) with pytest.raises(TypeError): plot.overlay_array(lst)