def test_removing_all_shapes_empty_array(): """Test removing all shapes with an empty list.""" data = 20 * np.random.random((10, 4, 2)) np.random.seed(0) layer = Shapes(data) assert layer.nshapes == 10 layer.data = np.empty((0, 2)) assert layer.nshapes == 0
def test_changing_shapes(): """Test changing Shapes data.""" shape_a = (10, 4, 2) shape_b = (20, 4, 2) np.random.seed(0) data_a = 20 * np.random.random(shape_a) data_b = 20 * np.random.random(shape_b) layer = Shapes(data_a) layer.data = data_b assert layer.nshapes == shape_b[0] assert np.all([np.all(ld == d) for ld, d in zip(layer.data, data_b)]) assert layer.ndim == shape_b[2] assert np.all([s == 'rectangle' for s in layer.shape_types])