Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def instantiate_reporter_for_test():
reporter = GenericDiffReporter.create('echo')
reporter.run_command = lambda command_array: None
return reporter
def instantiate_reporter_for_test():
reporter = TextDiffReporter()
reporter.run_command = lambda command_array: None
return reporter
def test(self):
alist = ['a', 'b', 'c', 'd', 'e']
approvals.verify_all('letters', alist, reporter=DiffReporter())
def test_get_pycharm_reporter(self):
verify(str(self.factory.get("PyCharm")), reporter=self.reporter)
"""
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)
def test_verify(self):
verify("Hello World.", self.reporter)
def test_basic_approval():
verify("foo")
"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)
"""
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)
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)