|
22 | 22 | import numpy as np
|
23 | 23 | from matplotlib.rcsetup import (validate_bool_maybe_none,
|
24 | 24 | validate_stringlist,
|
| 25 | + validate_colorlist, |
25 | 26 | validate_bool,
|
26 | 27 | validate_nseq_int,
|
27 | 28 | validate_nseq_float,
|
@@ -245,7 +246,9 @@ def test_Issue_1713():
|
245 | 246 |
|
246 | 247 | def _validation_test_helper(validator, arg, target):
|
247 | 248 | res = validator(arg)
|
248 |
| - if not isinstance(target, Cycler): |
| 249 | + if isinstance(target, np.ndarray): |
| 250 | + assert_true(np.all(res == target)) |
| 251 | + elif not isinstance(target, Cycler): |
249 | 252 | assert_equal(res, target)
|
250 | 253 | else:
|
251 | 254 | # Cyclers can't simply be asserted equal. They don't implement __eq__
|
@@ -343,6 +346,17 @@ def test_validators():
|
343 | 346 | (8, ValueError),
|
344 | 347 | ('X', ValueError)),
|
345 | 348 | },
|
| 349 | + {'validator': validate_colorlist, |
| 350 | + 'success': (('r,g,b', ['r', 'g', 'b']), |
| 351 | + (['r', 'g', 'b'], ['r', 'g', 'b']), |
| 352 | + ('r, ,', ['r']), |
| 353 | + (['', 'g', 'blue'], ['g', 'blue']), |
| 354 | + ([np.array([1, 0, 0]), np.array([0, 1, 0])], |
| 355 | + np.array([[1, 0, 0], [0, 1, 0]])), |
| 356 | + ), |
| 357 | + 'fail': (('fish', ValueError), |
| 358 | + ), |
| 359 | + } |
346 | 360 | )
|
347 | 361 |
|
348 | 362 | for validator_dict in validation_tests:
|
|
0 commit comments