def test_aggregates_widget_setattr(self): data = {"a": [1, 2, 3], "b": ["a", "b", "c"]} widget = PerspectiveWidget(data) widget.aggregates = { "a": Aggregate.ANY, "b": Aggregate.LAST } assert widget.aggregates == { "a": "any", "b": "last" }
def test_aggregates_widget_set_all(self): data = {"a": [1, 2, 3], "b": ["a", "b", "c"]} widget = PerspectiveWidget(data) for agg in Aggregate: widget.aggregates = {"a": agg} assert widget.aggregates == {"a": agg.value}
def test_aggregates_widget_setattr_invalid(self): data = {"a": [1, 2, 3], "b": ["a", "b", "c"]} widget = PerspectiveWidget(data) with raises(PerspectiveError): widget.aggregates = {"a": "?"}