def test_shape_validator():
trait = None
value = Mock()
correct = (1, 1)
validator = shape_validator(*correct)
value.shape = correct
assert validator(trait, value).shape == value.shape
incorrect = (1, 2)
value.shape = incorrect
pytest.raises(traitlets.TraitError, validator, trait, value)
评论列表
文章目录