def test_unexpected_pattern(): """Check that unexpected patterns result in a value error""" # Given session = FakeSession() pc = PredictorCollection(uuid.uuid4(), session) # Then with pytest.raises(ValueError): pc.auto_configure(GemTableDataSource(uuid.uuid4(), 0), "yogurt")
def test_returned_predictor(valid_graph_predictor_data): """Check that auto_configure works on the happy path.""" # Given session = FakeSession() # Setup a response that includes instance instead of config response = deepcopy(valid_graph_predictor_data) response["instance"] = response["config"] del response["config"] session.set_response(response) pc = PredictorCollection(uuid.uuid4(), session) # When result = pc.auto_configure(GemTableDataSource(uuid.uuid4(), 0), "PLAIN") # Then the response is parsed in a predictor assert result.name == valid_graph_predictor_data["display_name"] assert isinstance(result, GraphPredictor) # including nested predictors assert len(result.predictors) == 2 assert isinstance(result.predictors[0], uuid.UUID) assert isinstance(result.predictors[1], DeprecatedExpressionPredictor)