def test_show_1d_array(): plot = SigPlot() assert plot.arrays == [] assert plot.array_obj == {} data = [1, 2, 3] layer_type = '1D' plot.show_array(data, layer_type=layer_type) array_obj = { "data": data, "overrides": {}, "layerType": layer_type, } assert plot.array_obj == array_obj assert plot.arrays == [array_obj]
def test_subsize_show_2d_array(): plot = SigPlot() assert plot.arrays == [] assert plot.array_obj == {} data = [[1, 2, 3], [3, 4, 5]] layer_type = '2D' subsize = len(data[0]) plot.show_array(data, layer_type=layer_type, subsize=subsize) array_obj = { "data": data, "overrides": { "subsize": subsize }, "layerType": layer_type, } assert plot.array_obj == array_obj assert plot.arrays == [array_obj]
def test_no_subsize_show_2d_array(): plot = SigPlot() data = [[1, 2, 3], [3, 4, 5]] with pytest.raises(ValueError): plot.show_array(data, layer_type='2D', subsize=None)