How to use approvaltests - 10 common examples

To help you get started, we’ve selected a few approvaltests examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github approvals / ApprovalTests.Python / tests / reporters / test_genericdiffreporter.py View on Github external
def instantiate_reporter_for_test():
        reporter = GenericDiffReporter.create('echo')
        reporter.run_command = lambda command_array: None
        return reporter
github approvals / ApprovalTests.Python / tests / test_textdiffreporter.py View on Github external
def instantiate_reporter_for_test():
        reporter = TextDiffReporter()
        reporter.run_command = lambda command_array: None
        return reporter
github approvals / ApprovalTests.Python / tests / test_list.py View on Github external
def test(self):
        alist = ['a', 'b', 'c', 'd', 'e']
        approvals.verify_all('letters', alist, reporter=DiffReporter())
github approvals / ApprovalTests.Python / tests / reporters / test_genericdiffreporter.py View on Github external
def test_get_pycharm_reporter(self):
        verify(str(self.factory.get("PyCharm")), reporter=self.reporter)
github Flowminder / FlowKit / flowmachine / functional_tests / test_daily_location.py View on Github external
"""
    subset_query = CustomQuery(
        "SELECT DISTINCT msisdn AS subscriber FROM events.calls WHERE msisdn in ('GNLM7eW5J5wmlwRa', 'e6BxY8mAP38GyAQz', '1vGR8kp342yxEpwY')"
    )
    dl = daily_location(
        "2016-01-05",
        level="cell",
        hours=(23, 5),
        method="last",
        # subscriber_identifier="imei",
        # column_name="admin2pcod",
        # ignore_nulls=False,
        subscriber_subset=subset_query,
    )
    sql = pretty_sql(dl.get_query())
    verify(sql, diff_reporter)
github approvals / ApprovalTests.Python / tests / test_verify.py View on Github external
def test_verify(self):
        verify("Hello World.", self.reporter)
github Flowminder / FlowKit / flowmachine / functional_tests / test_daily_location.py View on Github external
"2016-01-04",
        level="admin2",
        hours=(3, 9),
        method="most-common",
        # subscriber_identifier="imei",
        # column_name="admin2pcod",
        ignore_nulls=False,
        subscriber_subset=[
            "2GJxeNazvlgZbqj6",
            "7qKmzkeMbmk5nOa0",
            "8dpPLR15XwR7jQyN",
            "1NqnrAB9bRd597x2",
        ],
    )
    df = get_dataframe(dl)
    verify(df.to_csv(), diff_reporter)
github Flowminder / FlowKit / flowmachine / functional_tests / test_daily_location.py View on Github external
"""
    subset_query = CustomQuery(
        "SELECT DISTINCT msisdn AS subscriber FROM events.calls WHERE msisdn in ('GNLM7eW5J5wmlwRa', 'e6BxY8mAP38GyAQz', '1vGR8kp342yxEpwY')"
    )
    dl = daily_location(
        "2016-01-05",
        level="cell",
        hours=(23, 5),
        method="last",
        # subscriber_identifier="imei",
        # column_name="admin2pcod",
        # ignore_nulls=False,
        subscriber_subset=subset_query,
    )
    df = get_dataframe(dl)
    verify(df.to_csv(), diff_reporter)
github Flowminder / FlowKit / flowmachine / functional_tests / test_daily_location.py View on Github external
def test_daily_location_4_sql(diff_reporter):
    """
    Regression test; this verifies the SQL statement for the test below (which checks the resulting dataframe)
    """
    subset_query = CustomQuery(
        "SELECT * FROM (VALUES ('dr9xNYK006wykgXj')) as tmp (subscriber)"
    )
    dl = daily_location(
        "2016-01-05",
        table="events.calls",
        hours=(22, 6),
        subscriber_subset=subset_query,
    )
    sql = pretty_sql(dl.get_query())
    verify(sql, diff_reporter)