def test_shape_palettes(): N = 10 # distinct shapes s = scale_shape_discrete() items = s.palette(N) assert (len(items) == N) assert (all([isinstance(x, str) for x in items])) items = s.palette(N + 5) assert (all([isinstance(x, str) for x in items[:N]])) with pytest.raises(PlotnineError): scale_shape_continuous()
def test_shape_palettes(): N = 10 # distinct shapes s = scale_shape_discrete() items = s.palette(N) assert(len(items) == N) assert(all([isinstance(x, six.string_types) for x in items])) items = s.palette(N+5) assert(all([isinstance(x, six.string_types) for x in items[:N]])) with pytest.raises(PlotnineError): scale_shape_continuous()
def test_shape_palettes(): N = 10 # distinct shapes s = scale_shape_discrete() items = s.palette(N) assert(len(items) == N) assert(all([isinstance(x, str) for x in items])) with pytest.warns(UserWarning): # More values than palette has items = s.palette(N+5) assert(all([isinstance(x, str) for x in items[:N]])) with pytest.raises(PlotnineError): scale_shape_continuous() # Unfilled N = 14 values = list(range(14)) s = scale_shape_discrete(unfilled=True) items = s.map(values, limits=values) assert len(items) == N assert(not all([isinstance(x, str) for x in items]))