def test_existing_experiment_view(self, create_db_instance, exp_config): """Hit exp_name + user's name in the db, fetch most recent entry.""" exp = ExperimentView('supernaedo2') assert exp._experiment._init_done is True assert exp._experiment._db._database is create_db_instance assert exp._id == exp_config[0][0]['_id'] assert exp.name == exp_config[0][0]['name'] assert exp.configuration['refers'] == exp_config[0][0]['refers'] assert exp.metadata == exp_config[0][0]['metadata'] assert exp._experiment._last_fetched == exp_config[0][0]['metadata'][ 'datetime'] assert exp.pool_size == exp_config[0][0]['pool_size'] assert exp.max_trials == exp_config[0][0]['max_trials'] assert exp.algorithms.configuration == exp_config[0][0]['algorithms'] with pytest.raises(AttributeError): exp.this_is_not_in_config = 5 # Test that experiment.push_completed_trial indeed exists exp._experiment.push_completed_trial with pytest.raises(AttributeError): exp.push_completed_trial with pytest.raises(AttributeError): exp.register_trial with pytest.raises(AttributeError): exp.reserve_trial
def test_existing_experiment_view(self, create_db_instance, exp_config): """Hit exp_name + user's name in the db, fetch most recent entry.""" exp = ExperimentView('supernaedo2') assert exp._experiment._init_done is False assert exp._id == exp_config[0][0]['_id'] assert exp.name == exp_config[0][0]['name'] assert exp.configuration['refers'] == exp_config[0][0]['refers'] assert exp.metadata == exp_config[0][0]['metadata'] assert exp.pool_size == exp_config[0][0]['pool_size'] assert exp.max_trials == exp_config[0][0]['max_trials'] # TODO: Views are not fully configured until configuration is refactored # assert exp.algorithms.configuration == exp_config[0][0]['algorithms'] with pytest.raises(AttributeError): exp.this_is_not_in_config = 5 # Test that experiment.update_completed_trial indeed exists exp._experiment.update_completed_trial with pytest.raises(AttributeError): exp.update_completed_trial with pytest.raises(AttributeError): exp.register_trial with pytest.raises(AttributeError): exp.reserve_trial