Skip to content

Commit

Permalink
issequence check for fill_color. wireservice#26
Browse files Browse the repository at this point in the history
  • Loading branch information
nbedi committed Jun 10, 2016
1 parent d268298 commit 933386f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions leather/shapes/grouped_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class GroupedBars(CategoryShape):
greater than or equal to the number of values in any category.
"""
def __init__(self, fill_color=None):
if fill_color and not issequence(fill_color):
raise ValueError('Fill color must be a sequence of strings.')

self._fill_color = fill_color
self._legend_dimension = Y

Expand Down
3 changes: 3 additions & 0 deletions tests/test_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ def test_invalid_fill_color(self):
with self.assertRaises(ValueError):
group = self.shape.to_svg(200, 100, self.linear, self.ordinal, series, ['one', 'two'])

with self.assertRaises(ValueError):
shape = leather.GroupedBars('red')

def test_nulls(self):
series = leather.CategorySeries([
(0, 'foo', 'first'),
Expand Down

0 comments on commit 933386f

Please sign in to comment.