Skip to content

Commit 0e5af3e

Browse files
committed
Fix passing a specific component to a 1D effect
Signed-off-by: martinRenou <[email protected]>
1 parent 2412f57 commit 0e5af3e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ipygany/ipygany.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ def _validate_input_impl(self, value):
469469

470470
# Input as a tuple
471471
if isinstance(value, (tuple, list)):
472+
if self.input_dim == 1 and len(value) == 2:
473+
return self._validate_input_component(value)
474+
472475
if len(value) != self.input_dim:
473476
raise TraitError('input is of dimension {} but expected input dimension is {}'.format(len(value), self.input_dim))
474477

tests/test_isocolor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ def test_input():
3030

3131
colored_mesh = IsoColor(poly)
3232

33-
with pytest.raises(TraitError):
34-
colored_mesh.input = ('1d', 0)
35-
3633
colored_mesh.input = ('1d', )
3734
assert colored_mesh.input == (('1d', 'x'), )
3835

36+
colored_mesh.input = ('3d', 'x')
37+
assert colored_mesh.input == ('3d', 'x')
38+
3939
colored_mesh.input = (3.2, )
4040
assert colored_mesh.input == (3.2, )
4141

0 commit comments

Comments
 (0)