def pytest_generate_tests(metafunc): """Parametrize the `observation_function` fixture. Add observation functions here to have them automatically run all the tests that take `observation_function` as input. """ if "observation_function" in metafunc.fixturenames: all_observation_functions = ( O.Nothing(), O.NodeBipartite(), O.StrongBranchingScores(True), O.StrongBranchingScores(False), ) metafunc.parametrize("observation_function", all_observation_functions)
def test_StrongBranchingScores_observation(solving_model): """Observation of StrongBranchingScores is a numpy array.""" obs = make_obs(O.StrongBranchingScores(), solving_model) assert_array(obs)
def test_StrongBranchingScores(solving_model): obs = O.StrongBranchingScores().obtain_observation(solving_model) assert isinstance(obs, np.ndarray) assert obs.size > 0 assert len(obs.shape) == 1