<commit_before># coding=utf-8
"""
Run Facade feature tests.

This sample uses the pytest-bdd extension for behavioral tests.
For educational purposes...
"""
import pytest
from flexmock import flexmock
from pytest_bdd import (
    given,
    scenario,
    then,
    when,
    parsers)

from sacredboard.app.business import RunFacade
from sacredboard.app.data import DataStorage, MetricsDAO, NotFoundError
from sacredboard.app.data.rundao import RunDAO


@pytest.mark.skip(reason="Bug in pytest-bdd https://github.com/pytest-dev/pytest-bdd/issues/250")
@scenario('runfacade.feature', 'Removing a run')
def test_removing_a_run1():
    """Removing a run."""
    pass


@pytest.mark.skip(reason="Bug in pytest-bdd https://github.com/pytest-dev/pytest-bdd/issues/250")
@scenario('runfacade.feature', 'Removing a run when two runs exist')
def test_abcremoving_a_run2():
    """Removing a run when two runs exist"""
    pass

@pytest.mark.skip(reason="Bug in pytest-bdd https://github.com/pytest-dev/pytest-bdd/issues/250")
@scenario('runfacade.feature', 'Removing a run with two metrics')
def test_removing_a_run_with_two_metrics():
    """Removing a run with two metrics"""
    pass

@when(parsers.parse('Run {run_id:d} exists'))
def a_run_exists(run_id, data_access):
    """A run exists."""
    data_access.get_run_dao().should_receive("get").with_args(run_id) \
        .and_return({"_id": run_id})
    assert data_access.get_run_dao().get(run_id) is not None


@when(parsers.parse('Metric {metric_id} of run {run_id:d} exists'))
def a_metric_of_that_run_exists(data_access, metric_id, run_id):<commit_msg>Re-enable BDD tests skipped because of a bug in pytest-bdd https://github.com/pytest-dev/pytest-bdd/issues/250<commit_after># coding=utf-8
"""
Run Facade feature tests.

This sample uses the pytest-bdd extension for behavioral tests.
For educational purposes...
"""
import pytest
from flexmock import flexmock
from pytest_bdd import (
    given,
    scenario,
    then,
    when,
    parsers)

from sacredboard.app.business import RunFacade
from sacredboard.app.data import DataStorage, MetricsDAO, NotFoundError
from sacredboard.app.data.rundao import RunDAO


@scenario('runfacade.feature', 'Removing a run')
def test_removing_a_run():
    """Removing a run."""
    pass


@scenario('runfacade.feature', 'Removing a run when two runs exist')
def test_removing_a_run():
    """Removing a run when two runs exist"""
    pass


@scenario('runfacade.feature', 'Removing a run with two metrics')
def test_removing_a_run_with_two_metrics():
    """Removing a run with two metrics"""
    pass


@when(parsers.parse('Run {run_id:d} exists'))
def a_run_exists(data_access, run_id):
    """A run exists."""
    data_access.get_run_dao().should_receive("get").with_args(run_id) \
        .and_return({"_id": run_id})
    assert data_access.get_run_dao().get(run_id) is not None


@when(parsers.parse('Metric {metric_id} of run {run_id:d} exists'))
def a_metric_of_that_run_exists(data_access, metric_id, run_id):
{'fraction_non_alphanumeric': 0.12541583499667333, 'fraction_numerical': 0.0053226879574184965, 'mean_word_length': 4.827519379844961, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4616974', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1053, 'n_words': 255}