def test_pandas_indexing(pd): # Should not fail break when faced with a # non-zero indexed series index = [11, 12, 13] ec = fc = pd.Series(['red', 'blue', 'green'], index=index) lw = pd.Series([1, 2, 3], index=index) ls = pd.Series(['solid', 'dashed', 'dashdot'], index=index) aa = pd.Series([True, False, True], index=index) Collection(edgecolors=ec) Collection(facecolors=fc) Collection(linewidths=lw) Collection(linestyles=ls) Collection(antialiaseds=aa)
def test_pandas_indexing(): try: import pandas as pd except ImportError: raise SkipTest("Pandas not installed") # Should not fail break when faced with a # non-zero indexed series index = [11, 12, 13] ec = fc = pd.Series(['red', 'blue', 'green'], index=index) lw = pd.Series([1, 2, 3], index=index) ls = pd.Series(['solid', 'dashed', 'dashdot'], index=index) aa = pd.Series([True, False, True], index=index) Collection(edgecolors=ec) Collection(facecolors=fc) Collection(linewidths=lw) Collection(linestyles=ls) Collection(antialiaseds=aa)
def test_collection_set_array(): vals = [*range(10)] # Test set_array with list c = Collection() c.set_array(vals) # Test set_array with wrong dtype with pytest.raises(TypeError, match="^Image data of dtype"): c.set_array("wrong_input") # Test if array kwarg is copied vals[5] = 45 assert np.not_equal(vals, c.get_array()).any()