repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
offu/WeRoBot | import os
import mongomock
import mockredis
import pytest
import sqlite3
import werobot
import werobot.testing
import werobot.utils
from werobot.session import SessionStorage
from werobot.session import filestorage, mongodbstorage, redisstorage, saekvstorage
from werobot.session import sqlitestorage
from werobot.sessi... | u"喵喵" | assert | complex_expr | tests/test_session.py | test_storage | 154 | null | |
offu/WeRoBot | import hashlib
import time
import os
import pytest
from werobot import WeRoBot
from werobot.utils import generate_token, to_text
def _make_xml(content):
return """
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>134883... | ValueError) | pytest.raises | variable | tests/test_robot.py | test_add_filter | 249 | null | |
offu/WeRoBot | from werobot import WeRoBot
from werobot.parser import parse_user_msg
from werobot.replies import TextReply
import os
werobot = WeRoBot(SESSION_STORAGE=False)
def teardown_module(module):
try:
os.remove(os.path.abspath("werobot_session"))
except OSError:
pass
def test_view_handler():
@wer... | u'汪汪' | assert | complex_expr | tests/test_handler.py | test_view_handler | 291 | null | |
offu/WeRoBot | import time
import pytest
from werobot.parser import parse_user_msg
from werobot.replies import WeChatReply, TextReply, ImageReply, MusicReply
from werobot.replies import VoiceReply, VideoReply
from werobot.replies import Article, ArticlesReply
from werobot.replies import TransferCustomerServiceReply, SuccessReply
fro... | 2 | assert | numeric_literal | tests/test_replies.py | test_process_articles_function_reply | 316 | null | |
offu/WeRoBot | from werobot.parser import parse_user_msg
def test_pic_sysphoto_event():
# count is 1
message = parse_user_msg(
"""
<xml>
<ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090651</Create... | 2 | assert | numeric_literal | tests/test_parser.py | test_pic_sysphoto_event | 340 | null | |
offu/WeRoBot | from werobot.messages.entries import get_value, StringEntry, FloatEntry, IntEntry
from werobot.utils import to_text
def test_string_entry():
assert isinstance(t.test_string, str)
assert t.test_string == "hello"
assert isinstance(t.test_int_to_string, str)
assert t.test_int_to_string == "123"
assert... | "1e-05" | assert | string_literal | tests/messages/test_entries.py | test_string_entry | 65 | null | |
offu/WeRoBot | import hashlib
import time
import os
import pytest
from werobot import WeRoBot
from werobot.utils import generate_token, to_text
def _make_xml(content):
return """
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>134883... | '喵' | assert | string_literal | tests/test_robot.py | test_error_page | 222 | null | |
offu/WeRoBot | import re
from werobot.utils import generate_token, check_token, to_text, to_binary
from werobot.utils import pay_sign_dict, make_error_page, is_regex
def test_to_text():
assert to_text(6) == str(6)
assert to_text(b"aa") == "aa"
assert to_text("cc") == "cc"
assert to_text(u"喵") == u" | u"喵" | assert | complex_expr | tests/test_utils.py | test_to_text | 19 | null | |
offu/WeRoBot | import os
import responses
import json
import pytest
import requests
import multipart
import urllib.parse
from io import BytesIO
from werobot import WeRoBot
from werobot.config import Config
from werobot.client import Client, check_error, ClientException
from werobot.utils import cached_property
BASE_DIR = os.path.di... | 2 | assert | numeric_literal | tests/test_client.py | send_all_openid_callback | TestClientMass | 1,805 | null |
offu/WeRoBot | import hashlib
import time
import os
import pytest
from werobot import WeRoBot
from werobot.utils import generate_token, to_text
def _make_xml(content):
return """
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>134883... | "token from config" | assert | string_literal | tests/test_robot.py | test_config_ignore | 229 | null | |
offu/WeRoBot | from werobot import WeRoBot
from werobot.parser import parse_user_msg
from werobot.replies import TextReply
import os
werobot = WeRoBot(SESSION_STORAGE=False)
def teardown_module(module):
try:
os.remove(os.path.abspath("werobot_session"))
except OSError:
pass
def test_user_get_card_handler():... | u'恭喜入坑' | assert | complex_expr | tests/test_handler.py | test_user_get_card_handler | 399 | null | |
offu/WeRoBot | from werobot import WeRoBot
from werobot.parser import parse_user_msg
from werobot.replies import TextReply
import os
werobot = WeRoBot(SESSION_STORAGE=False)
def teardown_module(module):
try:
os.remove(os.path.abspath("werobot_session"))
except OSError:
pass
def test_user_gifting_card_handle... | u'锅从天上来' | assert | complex_expr | tests/test_handler.py | test_user_gifting_card_handler | 427 | null | |
offu/WeRoBot | import hashlib
import time
import os
import pytest
from werobot import WeRoBot
from werobot.utils import generate_token, to_text
def _make_xml(content):
return """
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>134883... | 4 | assert | numeric_literal | tests/test_robot.py | test_filter | 197 | null | |
offu/WeRoBot | from werobot.parser import parse_user_msg
def test_pic_sysphoto_event():
# count is 1
message = parse_user_msg(
"""
<xml>
<ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090651</Create... | "6" | assert | string_literal | tests/test_parser.py | test_pic_sysphoto_event | 303 | null | |
offu/WeRoBot | import hashlib
import time
import os
import pytest
from werobot import WeRoBot
from werobot.utils import generate_token, to_text
def _make_xml(content):
return """
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>134883... | 3 | assert | numeric_literal | tests/test_robot.py | test_filter | 171 | null | |
offu/WeRoBot | import time
import pytest
from werobot.parser import parse_user_msg
from werobot.replies import WeChatReply, TextReply, ImageReply, MusicReply
from werobot.replies import VoiceReply, VideoReply
from werobot.replies import Article, ArticlesReply
from werobot.replies import TransferCustomerServiceReply, SuccessReply
fro... | to_text(s) | assert | func_call | tests/test_replies.py | test_wechat_reply | 33 | null | |
offu/WeRoBot | from werobot.messages.entries import get_value, StringEntry, FloatEntry, IntEntry
from werobot.utils import to_text
def test_float_entry():
assert isinstance(t.test_float, float)
assert t.test_float == | 0.00001 | assert | numeric_literal | tests/messages/test_entries.py | test_float_entry | 53 | null | |
offu/WeRoBot | from werobot.crypto import PrpCrypto, MessageCrypt
from werobot.utils import generate_token, to_binary, to_text
from werobot.parser import parse_xml
import time
def test_prpcrypto():
key = "ReUrr0NKeHkppBQq"
assert len(key) == 16
crypto = PrpCrypto(key)
text = generate_token(32)
app_id = generate... | to_binary(text) | assert | func_call | tests/test_crypto.py | test_prpcrypto | 17 | null | |
offu/WeRoBot | from werobot import WeRoBot
from werobot.parser import parse_user_msg
from werobot.replies import TextReply
import os
werobot = WeRoBot(SESSION_STORAGE=False)
def teardown_module(module):
try:
os.remove(os.path.abspath("werobot_session"))
except OSError:
pass
def test_card_sku_remind_handler(... | u'骗钱大成功' | assert | complex_expr | tests/test_handler.py | test_card_sku_remind_handler | 615 | null | |
offu/WeRoBot | import time
import pytest
from werobot.parser import parse_user_msg
from werobot.replies import WeChatReply, TextReply, ImageReply, MusicReply
from werobot.replies import VoiceReply, VideoReply
from werobot.replies import Article, ArticlesReply
from werobot.replies import TransferCustomerServiceReply, SuccessReply
fro... | 'fromUser' | assert | string_literal | tests/test_replies.py | test_wechat_reply | 32 | null | |
offu/WeRoBot | from werobot import WeRoBot
from werobot.parser import parse_user_msg
from werobot.replies import TextReply
import os
werobot = WeRoBot(SESSION_STORAGE=False)
def teardown_module(module):
try:
os.remove(os.path.abspath("werobot_session"))
except OSError:
pass
def test_user_del_card_handler():... | u'摆脱负担' | assert | complex_expr | tests/test_handler.py | test_user_del_card_handler | 452 | null | |
offu/WeRoBot | from werobot import WeRoBot
from werobot.parser import parse_user_msg
from werobot.replies import TextReply
import os
werobot = WeRoBot(SESSION_STORAGE=False)
def teardown_module(module):
try:
os.remove(os.path.abspath("werobot_session"))
except OSError:
pass
def test_click_handler():
@we... | u'喵喵' | assert | complex_expr | tests/test_handler.py | test_click_handler | 268 | null | |
offu/WeRoBot | import os
import mongomock
import mockredis
import pytest
import sqlite3
import werobot
import werobot.testing
import werobot.utils
from werobot.session import SessionStorage
from werobot.session import filestorage, mongodbstorage, redisstorage, saekvstorage
from werobot.session import sqlitestorage
from werobot.sessi... | 'ss' | assert | string_literal | tests/test_session.py | test_session | 74 | null | |
offu/WeRoBot | import os
from werobot import WeRoBot
from werobot.config import Config
from werobot.utils import generate_token
basedir = os.path.dirname(os.path.abspath(__file__))
TOKEN = "123"
def test_from_pyfile():
config = Config()
assert "TOKEN" not in config
config.from_pyfile(os.path.join(basedir, "test_config... | "123" | assert | string_literal | tests/test_config.py | test_from_pyfile | 16 | null | |
offu/WeRoBot | import hashlib
import time
import os
import pytest
from werobot import WeRoBot
from werobot.utils import generate_token, to_text
def _make_xml(content):
return """
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>134883... | TypeError) | pytest.raises | variable | tests/test_robot.py | test_add_filter | 257 | null | |
offu/WeRoBot | from werobot import WeRoBot
from werobot.parser import parse_user_msg
from werobot.replies import TextReply
import os
werobot = WeRoBot(SESSION_STORAGE=False)
def teardown_module(module):
try:
os.remove(os.path.abspath("werobot_session"))
except OSError:
pass
def test_card_not_pass_check_hand... | u'瞧一瞧没过' | assert | complex_expr | tests/test_handler.py | test_card_not_pass_check_handler | 367 | null | |
offu/WeRoBot | import os
import mongomock
import mockredis
import pytest
import sqlite3
import werobot
import werobot.testing
import werobot.utils
from werobot.session import SessionStorage
from werobot.session import filestorage, mongodbstorage, redisstorage, saekvstorage
from werobot.session import sqlitestorage
from werobot.sessi... | NotImplementedError) | pytest.raises | variable | tests/test_session.py | test_session_storage_get | 81 | null | |
offu/WeRoBot | import os
import responses
import json
import pytest
import requests
import multipart
import urllib.parse
from io import BytesIO
from werobot import WeRoBot
from werobot.config import Config
from werobot.client import Client, check_error, ClientException
from werobot.utils import cached_property
BASE_DIR = os.path.di... | keys | assert | variable | tests/test_client.py | check_menu_data | TestClientMenuClass | 249 | null |
offu/WeRoBot | from werobot.messages.entries import get_value, StringEntry, FloatEntry, IntEntry
from werobot.utils import to_text
def test_string_entry():
assert isinstance(t.test_string, str)
assert t.test_string == | "hello" | assert | string_literal | tests/messages/test_entries.py | test_string_entry | 61 | null | |
offu/WeRoBot | import re
from werobot.utils import generate_token, check_token, to_text, to_binary
from werobot.utils import pay_sign_dict, make_error_page, is_regex
def test_make_error_page():
rand_string = generate_token()
content = make_error_page(rand_string)
assert rand_string in | content | assert | variable | tests/test_utils.py | test_make_error_page | 55 | null | |
offu/WeRoBot | from werobot.messages.entries import get_value, StringEntry, FloatEntry, IntEntry
from werobot.utils import to_text
def test_get_value():
instance = FakeIntance()
instance.b = 6
instance.a = {'c': 'd'}
assert get_value(instance, 'd', 'default') == 'default'
assert get_value(instance, 'b', 'default'... | 'd' | assert | string_literal | tests/messages/test_entries.py | test_get_value | 81 | null | |
offu/WeRoBot | from werobot.crypto import PrpCrypto, MessageCrypt
from werobot.utils import generate_token, to_binary, to_text
from werobot.parser import parse_xml
import time
def test_prpcrypto():
key = "ReUrr0NKeHkppBQq"
assert len(key) == | 16 | assert | numeric_literal | tests/test_crypto.py | test_prpcrypto | 12 | null | |
offu/WeRoBot | import os
import random
import sys
import time
import pytest
import tornado
import webtest
from tornado.testing import AsyncHTTPSTestCase
from webtest.app import AppError
from werobot.parser import parse_xml, process_message
from werobot.utils import generate_token, get_signature
def wsgi_tester():
def tester(ap... | 403) | self.assertEqual | numeric_literal | tests/test_contrib.py | test_tornado | TestTornado | 293 | null |
offu/WeRoBot | import hashlib
import time
import os
import pytest
from werobot import WeRoBot
from werobot.utils import generate_token, to_text
def _make_xml(content):
return """
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>134883... | [(text_handler, 0)] | assert | collection | tests/test_robot.py | test_register_handlers | 53 | null | |
offu/WeRoBot | from werobot.parser import parse_user_msg
def test_pic_sysphoto_event():
# count is 1
message = parse_user_msg(
"""
<xml>
<ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090651</Create... | 1 | assert | numeric_literal | tests/test_parser.py | test_pic_sysphoto_event | 304 | null | |
ing-bank/popmon | import itertools
import numpy as np
from scipy import linalg, stats
from popmon.stats.numpy import (
mean,
probability_distribution_mean_covariance,
quantile,
std,
)
def get_data():
rng = np.random.default_rng(5)
a = rng.integers(0, 10, size=(3, 4, 5, 6))
w = rng.integers(0, 10, size=(3, ... | (3, 6) | assert | collection | tests/popmon/stats/test_numpy.py | test_mean_shapes | 38 | null | |
ing-bank/popmon | import pytest
from pydantic.error_wrappers import ValidationError
from popmon import Settings
def test_setting_validation():
settings = Settings()
with pytest.raises( | ValidationError) | pytest.raises | variable | tests/popmon/test_config.py | test_setting_validation | 18 | null | |
ing-bank/popmon | import copy
import json
import pandas as pd
import pytest
from popmon.io import FileWriter
DATA = {"name": ["Name"], "surname": ["Surname"]}
def get_ready_ds():
return copy.deepcopy({"my_data": DATA})
def to_json(data, **kwargs):
return json.dumps(data, **kwargs)
def to_pandas(data):
return pd.DataFra... | to_json(DATA) | assert | func_call | tests/popmon/io/test_file_writer.py | test_file_writer_json | 27 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon.analysis.apply_func import ApplyFunc, apply_func, apply_func_array
from popmon.analysis.functions import pull
from popmon.analysis.profiling.pull_calculator import (
ExpandingPullCalculator,
ReferencePullCalculator,
RefMedianMadPullCalculator... | 5) | assert_* | numeric_literal | tests/popmon/analysis/profiling/test_apply_func.py | test_variance_comparer | 98 | null | |
ing-bank/popmon | import itertools
import numpy as np
from scipy import linalg, stats
from popmon.stats.numpy import (
mean,
probability_distribution_mean_covariance,
quantile,
std,
)
def get_data():
rng = np.random.default_rng(5)
a = rng.integers(0, 10, size=(3, 4, 5, 6))
w = rng.integers(0, 10, size=(3, ... | mean(a)) | assert_* | func_call | tests/popmon/stats/test_numpy.py | test_mean_shapes | 29 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon.analysis.apply_func import ApplyFunc, apply_func, apply_func_array
from popmon.analysis.functions import pull
from popmon.analysis.profiling.pull_calculator import (
ExpandingPullCalculator,
ReferencePullCalculator,
RefMedianMadPullCalculator... | -1.0) | assert_* | numeric_literal | tests/popmon/analysis/profiling/test_apply_func.py | test_pull | 51 | null | |
ing-bank/popmon | import pytest
from popmon.base.registry import Registry
def test_registery():
MyRegistry = Registry()
@MyRegistry.register(key="example", description="hello world")
def example_function(my_input):
return 4 + my_input
@MyRegistry.register(
key=["coefficient", "p_value"],
descr... | { "example": "hello world", "coefficient": "phi_custom coefficient", "p_value": "p-value for the phi_custom coeff.", } | assert | collection | tests/popmon/base/test_registry.py | test_registery | 30 | null | |
ing-bank/popmon | import json
from popmon import resources
from popmon.io import FileReader
def test_file_reader_json():
fr = FileReader(
file_path=resources.data("example.json"),
store_key="example",
apply_func=json.loads,
)
datastore = fr.transform(datastore={})
assert datastore["example"]["b... | 0 | assert | numeric_literal | tests/popmon/io/test_file_reader.py | test_file_reader_json | 17 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon.alerting import (
ComputeTLBounds,
DynamicBounds,
StaticBounds,
TrafficLightAlerts,
pull_bounds,
traffic_light,
)
from popmon.analysis.apply_func import ApplyFunc
from popmon.analysis.functions import (
expanding_mean,
exp... | 0 | assert | numeric_literal | tests/popmon/alerting/test_apply_tl_bounds.py | test_traffic_light | 36 | null | |
ing-bank/popmon | from datetime import datetime, timedelta
import pandas as pd
import pytest
from popmon.pipeline.dataset_splitter import split_dataset
def test_split_dataset_pandas_int(test_dataframe_pandas):
reference, df = split_dataset(test_dataframe_pandas, split=3, time_axis="date")
assert reference.shape[0] == 3
a... | ["date", "f1", "f2"] | assert | collection | tests/popmon/pipeline/test_split_dataset.py | test_split_dataset_pandas_int | 27 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon.alerting import (
ComputeTLBounds,
DynamicBounds,
StaticBounds,
TrafficLightAlerts,
pull_bounds,
traffic_light,
)
from popmon.analysis.apply_func import ApplyFunc
from popmon.analysis.functions import (
expanding_mean,
exp... | [1] * 5 | assert | collection | tests/popmon/alerting/test_apply_tl_bounds.py | test_apply_monitoring_business_rules | 71 | null | |
ing-bank/popmon | import pytest
from popmon.base.registry import Registry
def test_registry_properties():
PropsRegistry = Registry()
@PropsRegistry.register(key="hello", description="world", dim=3, htype="all")
def my_func():
return 0
assert PropsRegistry.get_keys_by_dim_and_htype(dim=1, htype=None) == | [] | assert | collection | tests/popmon/base/test_registry.py | test_registry_properties | 44 | null | |
ing-bank/popmon | import pytest
from popmon.alerting import ComputeTLBounds, collect_traffic_light_bounds
def test_compute_traffic_light_bounds():
datastore = {"test_data": pytest.test_comparer_df}
conf = {
"monitoring_rules": {
"the_feature:mae": [8, 4, 2, 2],
"dummy_feature:*": [0, 0, 0, 0],
... | [0.2, 0.11, 0.09, 0] | assert | collection | tests/popmon/alerting/test_compute_tl_bounds.py | test_compute_traffic_light_bounds | 40 | null | |
ing-bank/popmon | from datetime import datetime, timedelta
from pathlib import Path
import pandas as pd
import pytest
from popmon.pipeline.dataset_splitter import split_dataset
def spark_context():
if not spark_found:
return None
current_path = Path(__file__).parent
scala = "2.12" if int(pyspark_version[0]) == 3... | 550 | assert | numeric_literal | tests/popmon/spark/test_split_dataset_spark.py | test_split_dataset_spark_float | 104 | null | |
ing-bank/popmon | import pytest
from popmon.base.registry import Registry
def test_registry_run():
RunRegistry = Registry()
@RunRegistry.register(key="key", description="run me", dim=1, htype="num")
def func(arg1, arg2):
return abs(arg1 - arg2)
args = [1, 4]
result = RunRegistry.run(args=args, dim=1, htyp... | {"key": 3} | assert | collection | tests/popmon/base/test_registry.py | test_registry_run | 84 | null | |
ing-bank/popmon | from popmon.config import Report
from popmon.utils import filter_metrics
def test_filter_metrics():
settings = Report()
metrics = [
"distinct_pull",
"filled_pull",
"nan_pull",
"mean_pull",
"std_pull",
"p05_pull",
"p10_pull",
"p50_pull",
"... | expected | assert | variable | tests/popmon/test_utils.py | test_filter_metrics | 42 | null | |
ing-bank/popmon | import numpy as np
import pytest
from popmon.analysis.comparison.comparisons import (
jensen_shannon_divergence,
ks_prob,
ks_test,
kullback_leibler_divergence,
population_stability_index,
uu_chi2,
)
@pytest.mark.filterwarnings("ignore:invalid value encountered in true_divide")
def test_uu_chi2... | arr1.shape[0]) | assert_* | complex_expr | tests/popmon/analysis/comparison/test_comparisons.py | test_uu_chi2 | 21 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
import pytest
from conftest import make_mixed_dataframe
from popmon.analysis.hist_numpy import (
assert_similar_hists,
check_similar_hists,
get_2dgrid,
get_consistent_numpy_1dhists,
get_consistent_numpy_2dgrids,
get_consistent_num... | 1 | assert | numeric_literal | tests/popmon/analysis/test_hist_numpy.py | test_histogram | 81 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon import resources
from popmon.analysis.apply_func import ApplyFunc
from popmon.analysis.comparison import (
ExpandingNormHistComparer,
ReferenceNormHistComparer,
RollingNormHistComparer,
)
from popmon.analysis.functions import (
expand,
... | 9.891821919006366) | assert_* | numeric_literal | tests/popmon/analysis/test_functions.py | test_chi_squared2 | 611 | null | |
ing-bank/popmon | import itertools
import numpy as np
from scipy import linalg, stats
from popmon.stats.numpy import (
mean,
probability_distribution_mean_covariance,
quantile,
std,
)
def get_data():
rng = np.random.default_rng(5)
a = rng.integers(0, 10, size=(3, 4, 5, 6))
w = rng.integers(0, 10, size=(3, ... | quantile(a, 0.5, w, axis=(1, 2), keepdims=False)) | assert_* | func_call | tests/popmon/stats/test_numpy.py | test_statistics_1 | 187 | null | |
ing-bank/popmon | import pytest
from popmon.base.registry import Registry
def test_registery():
MyRegistry = Registry()
@MyRegistry.register(key="example", description="hello world")
def example_function(my_input):
return 4 + my_input
@MyRegistry.register(
key=["coefficient", "p_value"],
descr... | "example_function" | assert | string_literal | tests/popmon/base/test_registry.py | test_registery | 27 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
from popmon.analysis.profiling.hist_profiler import HistProfiler
from popmon.hist.hist_utils import get_bin_centers
def test_profile_hist1d():
num_bins = 1000
num_entries = 10000
hist_name = "histogram"
split_len = 10
split = []
... | num_bins | assert | variable | tests/popmon/analysis/profiling/test_hist_profiler.py | test_profile_hist1d | 33 | null | |
ing-bank/popmon | import itertools
import numpy as np
from scipy import linalg, stats
from popmon.stats.numpy import (
mean,
probability_distribution_mean_covariance,
quantile,
std,
)
def get_data():
rng = np.random.default_rng(5)
a = rng.integers(0, 10, size=(3, 4, 5, 6))
w = rng.integers(0, 10, size=(3, ... | std(a)) | assert_* | func_call | tests/popmon/stats/test_numpy.py | test_std_shapes | 58 | null | |
ing-bank/popmon | from datetime import datetime, timedelta
from pathlib import Path
import pandas as pd
import pytest
from popmon.pipeline.dataset_splitter import split_dataset
def spark_context():
if not spark_found:
return None
current_path = Path(__file__).parent
scala = "2.12" if int(pyspark_version[0]) == 3... | 450 | assert | numeric_literal | tests/popmon/spark/test_split_dataset_spark.py | test_split_dataset_spark_float | 103 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon import resources
from popmon.analysis.apply_func import ApplyFunc
from popmon.analysis.comparison.hist_comparer import (
ExpandingHistComparer,
ReferenceHistComparer,
RollingHistComparer,
hist_compare,
)
from popmon.analysis.functions imp... | set(cols) | assert | func_call | tests/popmon/analysis/comparison/test_hist_comparer.py | test_reference_hist_comparer | 118 | null | |
ing-bank/popmon | import pytest
from popmon.base.registry import Registry
def test_registry_properties():
PropsRegistry = Registry()
@PropsRegistry.register(key="hello", description="world", dim=3, htype="all")
def my_func():
return 0
assert PropsRegistry.get_keys_by_dim_and_htype(dim=1, htype=None) == []
... | ["hello"] | assert | collection | tests/popmon/base/test_registry.py | test_registry_properties | 45 | null | |
ing-bank/popmon | from datetime import datetime, timedelta
from pathlib import Path
import pandas as pd
import pytest
from popmon.pipeline.dataset_splitter import split_dataset
def spark_context():
if not spark_found:
return None
current_path = Path(__file__).parent
scala = "2.12" if int(pyspark_version[0]) == 3... | 3 | assert | numeric_literal | tests/popmon/spark/test_split_dataset_spark.py | test_split_dataset_spark_int | 62 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon import resources
from popmon.analysis.apply_func import ApplyFunc
from popmon.analysis.comparison.hist_comparer import (
ExpandingHistComparer,
ReferenceHistComparer,
RollingHistComparer,
hist_compare,
)
from popmon.analysis.functions imp... | 0.7017543859649122) | assert_* | numeric_literal | tests/popmon/analysis/comparison/test_hist_comparer.py | test_hist_compare | 67 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon import resources
from popmon.analysis.apply_func import ApplyFunc
from popmon.analysis.comparison import (
ExpandingNormHistComparer,
ReferenceNormHistComparer,
RollingNormHistComparer,
)
from popmon.analysis.functions import (
expand,
... | 0.849999999999999) | assert_* | numeric_literal | tests/popmon/analysis/test_functions.py | test_chi_squared1 | 558 | null | |
ing-bank/popmon | import logging
import numpy as np
import pytest
from popmon.base import Module, Pipeline
def test_pipeline_repr(test_pipeline):
assert | """Pipeline: [\n\tPipeline: [\n\t\tLogTransformer(input_key='x', output_key='log_x')\n\t\tPowerTransformer(input_key='log_x', output_key='log_pow_x')\n\t]\n\tSumNormalizer(input_key='weights', output_key='norm_weights')\n\tWeightedSum(input_key='log_pow_x', weight_key='norm_weights', output_key='res')\n]""" | assert | string_literal | tests/popmon/base/test_pipeline.py | test_pipeline_repr | 107 | null | |
ing-bank/popmon | import itertools
import numpy as np
from scipy import linalg, stats
from popmon.stats.numpy import (
mean,
probability_distribution_mean_covariance,
quantile,
std,
)
def get_data():
rng = np.random.default_rng(5)
a = rng.integers(0, 10, size=(3, 4, 5, 6))
w = rng.integers(0, 10, size=(3, ... | 1 | assert | numeric_literal | tests/popmon/stats/test_numpy.py | test_quantiles_shapes | 86 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
from conftest import make_mixed_dataframe
from popmon.hist.hist_utils import (
is_numeric,
is_timestamp,
project_on_x,
project_split2dhist_on_axis,
sparse_bin_centers_x,
split_hist_along_first_dimension,
sum_entries,
sum_o... | bin_edges1) | assert_* | variable | tests/popmon/hist/test_histogram.py | test_project_split2dhist_on_axis | 315 | null | |
ing-bank/popmon | import itertools
import numpy as np
from scipy import linalg, stats
from popmon.stats.numpy import (
mean,
probability_distribution_mean_covariance,
quantile,
std,
)
def get_data():
rng = np.random.default_rng(5)
a = rng.integers(0, 10, size=(3, 4, 5, 6))
w = rng.integers(0, 10, size=(3, ... | 1) | assert_* | numeric_literal | tests/popmon/stats/test_numpy.py | test_probability_distribution_mean_covariance | 240 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
import pytest
from conftest import make_mixed_dataframe
from popmon.analysis.hist_numpy import (
assert_similar_hists,
check_similar_hists,
get_2dgrid,
get_consistent_numpy_1dhists,
get_consistent_numpy_2dgrids,
get_consistent_num... | entries1) | assert_* | variable | tests/popmon/analysis/test_hist_numpy.py | test_get_consistent_numpy_1dhists | 283 | null | |
ing-bank/popmon | import pandas as pd
from popmon.analysis.merge_statistics import MergeStatistics
def test_merge_statistics():
df1 = pd.DataFrame(
{
"A": ["A0", "A1", "A2", "A3"],
"B": ["B0", "B1", "B2", "B3"],
"C": ["C0", "C1", "C2", "C3"],
"D": ["D0", "D1", "D2", "D3"],
... | out) | assert_* | variable | tests/popmon/analysis/test_merge_statistics.py | test_merge_statistics | 45 | null | |
ing-bank/popmon | import pytest
from popmon.alerting import ComputeTLBounds, collect_traffic_light_bounds
def test_compute_traffic_light_funcs():
datastore = {"test_data": pytest.test_comparer_df}
conf = {
"monitoring_rules": {
"the_feature:mae": [8, 4, 2, 2],
"dummy_feature:*": [0, 0, 0, 0],
... | 3 | assert | numeric_literal | tests/popmon/alerting/test_compute_tl_bounds.py | test_compute_traffic_light_funcs | 63 | null | |
ing-bank/popmon | import pytest
from popmon.base.registry import Registry
def test_registery():
MyRegistry = Registry()
@MyRegistry.register(key="example", description="hello world")
def example_function(my_input):
return 4 + my_input
@MyRegistry.register(
key=["coefficient", "p_value"],
descr... | ["example", "coefficient", "p_value"] | assert | collection | tests/popmon/base/test_registry.py | test_registery | 29 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
import pytest
from conftest import make_mixed_dataframe
from popmon.analysis.hist_numpy import (
assert_similar_hists,
check_similar_hists,
get_2dgrid,
get_consistent_numpy_1dhists,
get_consistent_numpy_2dgrids,
get_consistent_num... | []) | assert_* | collection | tests/popmon/analysis/test_hist_numpy.py | test_prepare_2dgrid | 125 | null | |
ing-bank/popmon | import pandas as pd
import pytest
from popmon import resources
from popmon.base import Pipeline
from popmon.config import Settings
from popmon.hist.filling import get_bin_specs
from popmon.io import JsonReader
from popmon.pipeline.report import df_stability_report, stability_report
def test_df_stability_report_self()... | bin_specs["date:eyeColor"][0]["binWidth"] | assert | complex_expr | tests/popmon/pipeline/test_report.py | test_df_stability_report_self | 95 | null | |
ing-bank/popmon | import pandas as pd
import pytest
from popmon import resources
from popmon.analysis.comparison.hist_comparer import ReferenceHistComparer
from popmon.base import Pipeline
from popmon.config import Settings
from popmon.hist.hist_splitter import HistSplitter
from popmon.io import JsonReader
from popmon.visualization imp... | datastore | assert | variable | tests/popmon/visualization/test_report_generator.py | test_report_generator | 60 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
from conftest import make_mixed_dataframe
from popmon.hist.hist_utils import (
is_numeric,
is_timestamp,
project_on_x,
project_split2dhist_on_axis,
sparse_bin_centers_x,
split_hist_along_first_dimension,
sum_entries,
sum_o... | check3b) | assert_* | variable | tests/popmon/hist/test_histogram.py | test_split_hist_along_first_dimension | 117 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
from conftest import make_mixed_dataframe
from popmon.hist.hist_utils import (
is_numeric,
is_timestamp,
project_on_x,
project_split2dhist_on_axis,
sparse_bin_centers_x,
split_hist_along_first_dimension,
sum_entries,
sum_o... | 5 | assert | numeric_literal | tests/popmon/hist/test_histogram.py | test_histogrammar | 49 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon.analysis.apply_func import ApplyFunc, apply_func, apply_func_array
from popmon.analysis.functions import pull
from popmon.analysis.profiling.pull_calculator import (
ExpandingPullCalculator,
ReferencePullCalculator,
RefMedianMadPullCalculator... | cols) | assert_* | variable | tests/popmon/analysis/profiling/test_apply_func.py | test_apply_func_array | 216 | null | |
ing-bank/popmon | import pytest
from popmon.alerting import ComputeTLBounds, collect_traffic_light_bounds
def test_collect_traffic_light_bounds():
test_dict = {"a": 2, "b:c": 5, "b:d": 6, "x:y:z": 17}
pkeys, nkeys = collect_traffic_light_bounds(test_dict)
assert nkeys == ["a"]
assert len(pkeys) == | 2 | assert | numeric_literal | tests/popmon/alerting/test_compute_tl_bounds.py | test_collect_traffic_light_bounds | 12 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon.analysis.apply_func import ApplyFunc, apply_func, apply_func_array
from popmon.analysis.functions import pull
from popmon.analysis.profiling.pull_calculator import (
ExpandingPullCalculator,
ReferencePullCalculator,
RefMedianMadPullCalculator... | 0.5) | assert_* | numeric_literal | tests/popmon/analysis/profiling/test_apply_func.py | test_apply_func_module | 75 | null | |
ing-bank/popmon | import numpy as np
from popmon.analysis.profiling.profiles import profile_fraction_of_true
def test_fraction_of_true():
res = profile_fraction_of_true([], [])
assert np.isnan(res)
res = profile_fraction_of_true(["a"], [10])
assert np.isnan(res)
res = profile_fraction_of_true(["a", "b", "c"], [10, ... | 0.0 | assert | numeric_literal | tests/popmon/analysis/profiling/test_profiles.py | test_fraction_of_true | 26 | null | |
ing-bank/popmon | import pytest
from popmon.alerting import ComputeTLBounds, collect_traffic_light_bounds
def test_collect_traffic_light_bounds():
test_dict = {"a": 2, "b:c": 5, "b:d": 6, "x:y:z": 17}
pkeys, nkeys = collect_traffic_light_bounds(test_dict)
assert nkeys == ["a"]
assert len(pkeys) == 2
assert pkeys... | ["z"] | assert | collection | tests/popmon/alerting/test_compute_tl_bounds.py | test_collect_traffic_light_bounds | 13 | null | |
ing-bank/popmon | import numpy as np
from popmon.visualization.histogram_section import get_top_categories
def test_get_top_categories():
entries_list = np.array([[1, 2], [4, 3], [1, 3], [3, 3]])
bins = ["cat1", "cat2", "cat3", "cat4"]
top_lim = 2
e0, b0 = get_top_categories(entries_list, bins, top_lim)
e1 = np.a... | e1) | assert_* | variable | tests/popmon/visualization/test_heatmaps.py | test_get_top_categories | 16 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
from conftest import make_mixed_dataframe
from popmon.hist.hist_utils import (
is_numeric,
is_timestamp,
project_on_x,
project_split2dhist_on_axis,
sparse_bin_centers_x,
split_hist_along_first_dimension,
sum_entries,
sum_o... | "Count" | assert | string_literal | tests/popmon/hist/test_histogram.py | test_split_hist_along_first_dimension | 175 | null | |
ing-bank/popmon | from datetime import datetime, timedelta
import pandas as pd
import pytest
from popmon.pipeline.dataset_splitter import split_dataset
def test_split_dataset_pandas_float(test_dataframe_pandas):
reference, df = split_dataset(test_dataframe_pandas, split=0.45, time_axis="date")
assert reference.shape[0] == 45... | 550 | assert | numeric_literal | tests/popmon/pipeline/test_split_dataset.py | test_split_dataset_pandas_float | 52 | null | |
ing-bank/popmon | import numpy as np
from popmon.visualization.histogram_section import get_top_categories
def test_get_top_categories():
entries_list = np.array([[1, 2], [4, 3], [1, 3], [3, 3]])
bins = ["cat1", "cat2", "cat3", "cat4"]
top_lim = 2
e0, b0 = get_top_categories(entries_list, bins, top_lim)
e1 = np.a... | b1) | assert_* | variable | tests/popmon/visualization/test_heatmaps.py | test_get_top_categories | 17 | null | |
ing-bank/popmon | import pandas as pd
import pytest
from popmon import resources
from popmon.base import Pipeline
from popmon.config import Settings
from popmon.hist.filling import get_bin_specs
from popmon.io import JsonReader
from popmon.pipeline.report import df_stability_report, stability_report
def test_df_stability_report_self()... | bin_specs["date:eyeColor"][0]["origin"] | assert | complex_expr | tests/popmon/pipeline/test_report.py | test_df_stability_report_self | 96 | null | |
ing-bank/popmon | from datetime import datetime, timedelta
from pathlib import Path
import pandas as pd
import pytest
from popmon.pipeline.dataset_splitter import split_dataset
def spark_context():
if not spark_found:
return None
current_path = Path(__file__).parent
scala = "2.12" if int(pyspark_version[0]) == 3... | ["date", "f1", "f2"] | assert | collection | tests/popmon/spark/test_split_dataset_spark.py | test_split_dataset_spark_int | 64 | null | |
ing-bank/popmon | import pytest
from popmon.alerting import ComputeTLBounds, collect_traffic_light_bounds
def test_compute_traffic_light_funcs():
datastore = {"test_data": pytest.test_comparer_df}
conf = {
"monitoring_rules": {
"the_feature:mae": [8, 4, 2, 2],
"dummy_feature:*": [0, 0, 0, 0],
... | (0, 0, 0, 0) | assert | collection | tests/popmon/alerting/test_compute_tl_bounds.py | test_compute_traffic_light_funcs | 67 | null | |
ing-bank/popmon | import pytest
from popmon.base.registry import Registry
def test_registery():
MyRegistry = Registry()
@MyRegistry.register(key="example", description="hello world")
def example_function(my_input):
return 4 + my_input
@MyRegistry.register(
key=["coefficient", "p_value"],
descr... | 5 | assert | numeric_literal | tests/popmon/base/test_registry.py | test_registery | 23 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
import pytest
from conftest import make_mixed_dataframe
from popmon.analysis.hist_numpy import (
assert_similar_hists,
check_similar_hists,
get_2dgrid,
get_consistent_numpy_1dhists,
get_consistent_numpy_2dgrids,
get_consistent_num... | labels) | assert_* | variable | tests/popmon/analysis/test_hist_numpy.py | test_get_consistent_numpy_entries | 339 | null | |
ing-bank/popmon | import itertools
import numpy as np
from scipy import linalg, stats
from popmon.stats.numpy import (
mean,
probability_distribution_mean_covariance,
quantile,
std,
)
def get_data():
rng = np.random.default_rng(5)
a = rng.integers(0, 10, size=(3, 4, 5, 6))
w = rng.integers(0, 10, size=(3, ... | std(a, w, axis=(1, 2), keepdims=True)) | assert_* | func_call | tests/popmon/stats/test_numpy.py | test_statistics_1 | 158 | null | |
ing-bank/popmon | from datetime import datetime, timedelta
from pathlib import Path
import pandas as pd
import pytest
from popmon.pipeline.dataset_splitter import split_dataset
def spark_context():
if not spark_found:
return None
current_path = Path(__file__).parent
scala = "2.12" if int(pyspark_version[0]) == 3... | 997 | assert | numeric_literal | tests/popmon/spark/test_split_dataset_spark.py | test_split_dataset_spark_int | 63 | null | |
ing-bank/popmon | import copy
import json
import pandas as pd
import pytest
from popmon.io import FileWriter
DATA = {"name": ["Name"], "surname": ["Surname"]}
def get_ready_ds():
return copy.deepcopy({"my_data": DATA})
def to_json(data, **kwargs):
return json.dumps(data, **kwargs)
def to_pandas(data):
return pd.DataFra... | to_pandas(DATA).to_dict() | assert | func_call | tests/popmon/io/test_file_writer.py | test_file_writer_df | 48 | null | |
ing-bank/popmon | import numpy as np
import pandas as pd
import pytest
from popmon.analysis.apply_func import ApplyFunc, apply_func, apply_func_array
from popmon.analysis.functions import pull
from popmon.analysis.profiling.pull_calculator import (
ExpandingPullCalculator,
ReferencePullCalculator,
RefMedianMadPullCalculator... | 28.86607) | assert_* | numeric_literal | tests/popmon/analysis/profiling/test_apply_func.py | test_apply_func_module | 74 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
from conftest import make_mixed_dataframe
from popmon.hist.hist_utils import (
is_numeric,
is_timestamp,
project_on_x,
project_split2dhist_on_axis,
sparse_bin_centers_x,
split_hist_along_first_dimension,
sum_entries,
sum_o... | 1 | assert | numeric_literal | tests/popmon/hist/test_histogram.py | test_histogrammar | 50 | null | |
ing-bank/popmon | import pytest
from popmon.base.registry import Registry
def test_registry_duplicate():
DuplicatedRegistry = Registry()
@DuplicatedRegistry.register(key="test", description="me")
def func1():
pass
with pytest.raises(ValueError) as e:
@DuplicatedRegistry.register(key="another", descri... | "A function with the name 'func1' has already been registered." | assert | string_literal | tests/popmon/base/test_registry.py | test_registry_duplicate | 61 | null | |
ing-bank/popmon | import json
from popmon import resources
from popmon.io import FileReader
def test_file_reader_json():
fr = FileReader(
file_path=resources.data("example.json"),
store_key="example",
apply_func=json.loads,
)
datastore = fr.transform(datastore={})
assert datastore["example"]["b... | 3 | assert | numeric_literal | tests/popmon/io/test_file_reader.py | test_file_reader_json | 16 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
import pytest
from conftest import make_mixed_dataframe
from popmon.analysis.hist_numpy import (
assert_similar_hists,
check_similar_hists,
get_2dgrid,
get_consistent_numpy_1dhists,
get_consistent_numpy_2dgrids,
get_consistent_num... | entries2) | assert_* | variable | tests/popmon/analysis/test_hist_numpy.py | test_get_consistent_numpy_1dhists | 285 | null | |
ing-bank/popmon | import histogrammar as hg
import numpy as np
import pandas as pd
from conftest import make_mixed_dataframe
from popmon.hist.hist_utils import (
is_numeric,
is_timestamp,
project_on_x,
project_split2dhist_on_axis,
sparse_bin_centers_x,
split_hist_along_first_dimension,
sum_entries,
sum_o... | splitC1 | assert | variable | tests/popmon/hist/test_histogram.py | test_project_split2dhist_on_axis | 324 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.