repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_rpc.py | test_rpc_backend_yield | assert | numeric_literal | 50 | import pytest
import os
import sys
from functools import partial
import threading
import pytest
import time
from time import sleep
import gc
from typeguard import typeguard_ignore
from unittest import mock
from nerfbaselines.utils import CancelledException, CancellationToken
from nerfbaselines.backends._common import ... | 0 | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_rpc.py | test_rpc_backend_static_function | assert | numeric_literal | 56 | import pytest
import os
import sys
from functools import partial
import threading
import pytest
import time
from time import sleep
import gc
from typeguard import typeguard_ignore
from unittest import mock
from nerfbaselines.utils import CancelledException, CancellationToken
from nerfbaselines.backends._common import ... | 4 | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_rpc_protocol.py | test_protocol_wait_for_worker_timeout | pytest.raises | variable | 41 | import time
import sys
import contextlib
import threading
import pytest
import functools
import signal
from nerfbaselines.backends._rpc import _transport_protocols_registry
def _signal_handler(signum, frame):
del signum, frame
pytest.fail("Timeout")
def timeout(timeout):
def decorator(fn):
@functo... | TimeoutError) | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_rpc_protocol.py | test_protocol_close_connection_worker | pytest.raises | variable | 101 | import time
import sys
import contextlib
import threading
import pytest
import functools
import signal
from nerfbaselines.backends._rpc import _transport_protocols_registry
def _signal_handler(signum, frame):
del signum, frame
pytest.fail("Timeout")
def timeout(timeout):
def decorator(fn):
@functo... | ConnectionError) | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_train_render.py | render | assert | numeric_literal | 70 | import sys
import shutil
import json
from typing import cast
from pathlib import Path
import os
import numpy as np
from nerfbaselines import Method, MethodInfo, Cameras, RenderOutput, ModelInfo
from nerfbaselines.utils import Indices
from nerfbaselines.datasets import _colmap_utils as colmap_utils
from nerfbaselines im... | 0 | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_train_render.py | test_train_command | assert | numeric_literal | 94 | import sys
import shutil
import json
from typing import cast
from pathlib import Path
import os
import numpy as np
from nerfbaselines import Method, MethodInfo, Cameras, RenderOutput, ModelInfo
from nerfbaselines.utils import Indices
from nerfbaselines.datasets import _colmap_utils as colmap_utils
from nerfbaselines im... | 12 | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_train_render.py | test_train_command | assert | numeric_literal | 109 | import sys
import shutil
import json
from typing import cast
from pathlib import Path
import os
import numpy as np
from nerfbaselines import Method, MethodInfo, Cameras, RenderOutput, ModelInfo
from nerfbaselines.utils import Indices
from nerfbaselines.datasets import _colmap_utils as colmap_utils
from nerfbaselines im... | 13 | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_train_render.py | test_train_command_extras | assert | none_literal | 64 | import sys
import shutil
import json
from typing import cast
from pathlib import Path
import os
import numpy as np
from nerfbaselines import Method, MethodInfo, Cameras, RenderOutput, ModelInfo
from nerfbaselines.utils import Indices
from nerfbaselines.datasets import _colmap_utils as colmap_utils
from nerfbaselines im... | None | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_train_render.py | test_train_command_extras | assert | complex_expr | 93 | import sys
import shutil
import json
from typing import cast
from pathlib import Path
import os
import numpy as np
from nerfbaselines import Method, MethodInfo, Cameras, RenderOutput, ModelInfo
from nerfbaselines.utils import Indices
from nerfbaselines.datasets import _colmap_utils as colmap_utils
from nerfbaselines im... | results["metrics"] | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_utils.py | test_cancel_generator | assert | numeric_literal | 26 | from unittest import mock
import pytest
from time import sleep, perf_counter
from nerfbaselines.utils import Indices
from nerfbaselines.utils import CancellationToken, CancelledException
def test_cancel_generator():
was_called = False
def fn():
nonlocal was_called
was_called = True
for... | 1 | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_utils.py | test_tuple_click_type | assert | numeric_literal | 19 | from unittest import mock
import pytest
from time import sleep, perf_counter
from nerfbaselines.utils import Indices
from nerfbaselines.utils import CancellationToken, CancelledException
def test_tuple_click_type():
import click
from nerfbaselines.cli._common import TupleClickType
with mock.patch("sys.arg... | 0 | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_utils.py | cmd | assert | collection | 11 | from unittest import mock
import pytest
from time import sleep, perf_counter
from nerfbaselines.utils import Indices
from nerfbaselines.utils import CancellationToken, CancelledException
@click.command()
@click.option("--val", type=TupleClickType(), default=())
def cmd(val):
assert... | () | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_utils.py | cmd | assert | none_literal | 11 | from unittest import mock
import pytest
from time import sleep, perf_counter
from nerfbaselines.utils import Indices
from nerfbaselines.utils import CancellationToken, CancelledException
@click.command()
@click.option("--val", type=TupleClickType(), default=None)
def cmd(val):
asse... | None | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_utils.py | test_indices_last | assert | variable | 13 | from unittest import mock
import pytest
from time import sleep, perf_counter
from nerfbaselines.utils import Indices
from nerfbaselines.utils import CancellationToken, CancelledException
def test_indices_last():
indices = Indices([-1])
indices.total = 12
for i in range(12):
if i == indices.total - ... | indices | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_utils.py | cmd | assert | collection | 11 | from unittest import mock
import pytest
from time import sleep, perf_counter
from nerfbaselines.utils import Indices
from nerfbaselines.utils import CancellationToken, CancelledException
@click.command()
@click.option("--val", type=TupleClickType(), default=())
def cmd(val):
assert... | ("1","2") | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_utils.py | test_tuple_click_type | pytest.raises | variable | 13 | from unittest import mock
import pytest
from time import sleep, perf_counter
from nerfbaselines.utils import Indices
from nerfbaselines.utils import CancellationToken, CancelledException
def test_tuple_click_type():
import click
from nerfbaselines.cli._common import TupleClickType
with mock.patch("sys.arg... | SystemExit) | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_utils.py | test_cancel_generator | pytest.raises | variable | 22 | from unittest import mock
import pytest
from time import sleep, perf_counter
from nerfbaselines.utils import Indices
from nerfbaselines.utils import CancellationToken, CancelledException
def test_cancel_generator():
was_called = False
def fn():
nonlocal was_called
was_called = True
for... | CancelledException) | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_viewer.py | test_viewer_simple_http_server | assert | numeric_literal | 19 | import pytest
import requests
import platform
def test_viewer_simple_http_server():
# Skip test on windows
if platform.system() == "Windows":
pytest.skip("Windows needs to be tested first.")
from nerfbaselines.viewer import Viewer
with Viewer() as viewer:
assert viewer.port is not Non... | 200 | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_viewer.py | test_viewer_simple_http_server | assert | none_literal | 14 | import pytest
import requests
import platform
def test_viewer_simple_http_server():
# Skip test on windows
if platform.system() == "Windows":
pytest.skip("Windows needs to be tested first.")
from nerfbaselines.viewer import Viewer
with Viewer() as viewer:
assert viewer.port is not | None | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nerfbaselines/nerfbaselines | ef71998824668788299851085740a552695cc5d1 | 90 | train | train | tests/test_viewer.py | test_viewer_simple_http_server | pytest.raises | variable | 28 | import pytest
import requests
import platform
def test_viewer_simple_http_server():
# Skip test on windows
if platform.system() == "Windows":
pytest.skip("Windows needs to be tested first.")
from nerfbaselines.viewer import Viewer
with Viewer() as viewer:
assert viewer.port is not Non... | Exception) | ef71998824668788299851085740a552695cc5d1 | 90 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_amharic.py | test_am_sbd | assert | variable | 14 | import pytest
GOLDEN_AM_RULES_TEST_CASES = [
("እንደምን አለህ፧መልካም ቀን ይሁንልህ።እባክሽ ያልሽዉን ድገሚልኝ።",
["እንደምን አለህ፧", "መልካም ቀን ይሁንልህ።", "እባክሽ ያልሽዉን ድገሚልኝ።"]),
]
@pytest.mark.parametrize('text,expected_sents', GOLDEN_AM_RULES_TEST_CASES)
def test_am_sbd(am_default_fixture, text, expected_sents):
"""Amharic language S... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_arabic.py | test_ar_sbd | assert | variable | 23 | import pytest
GOLDEN_AR_RULES_TEST_CASES = [
("سؤال وجواب: ماذا حدث بعد الانتخابات الايرانية؟ طرح الكثير من التساؤلات غداة ظهور نتائج الانتخابات الرئاسية الايرانية التي أججت مظاهرات واسعة واعمال عنف بين المحتجين على النتائج ورجال الامن. يقول معارضو الرئيس الإيراني إن الطريقة التي اعلنت بها النتائج كانت مثيرة للاست... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_armenian.py | test_hy_sbd | assert | variable | 87 | import pytest
GOLDEN_HY_RULES_TEST_CASES = [
("Ի՞նչ ես մտածում: Ոչինչ:",
["Ի՞նչ ես մտածում:", "Ոչինչ:"]),
("Ապրիլի 24-ին սկսեց անձրևել...Այդպես էի գիտեի:",
["Ապրիլի 24-ին սկսեց անձրևել...Այդպես էի գիտեի:"]),
("Այսպիսով` մոտենում ենք ավարտին: Տրամաբանությյունը հետևյալն է. պարզություն և աշխատանք:... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_bulgarian.py | test_bg_sbd | assert | variable | 20 | import pytest
GOLDEN_BG_RULES_TEST_CASES = [
("В първата половина на ноември т.г. ще бъде свикан Консултативният съвет за национална сигурност, обяви държавният глава.",
["В първата половина на ноември т.г. ще бъде свикан Консултативният съвет за национална сигурност, обяви държавният глава."]),
("Компютърът е устрой... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_burmese.py | test_my_sbd | assert | variable | 14 | import pytest
GOLDEN_MY_RULES_TEST_CASES = [
("ခင္ဗ်ားနာမည္ဘယ္လိုေခၚလဲ။၇ွင္ေနေကာင္းလား။",
["ခင္ဗ်ားနာမည္ဘယ္လိုေခၚလဲ။", "၇ွင္ေနေကာင္းလား။"])
]
@pytest.mark.parametrize('text,expected_sents', GOLDEN_MY_RULES_TEST_CASES)
def test_my_sbd(my_default_fixture, text, expected_sents):
"""Burmese language SBD tests"""
... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_chinese.py | test_zsh_sbd | assert | variable | 16 | import pytest
GOLDEN_ZH_RULES_TEST_CASES = [
("安永已聯繫周怡安親屬,協助辦理簽證相關事宜,周怡安家屬1月1日晚間搭乘東方航空班機抵達上海,他們步入入境大廳時神情落寞、不發一語。周怡安來自台中,去年剛從元智大學畢業,同年9月加入安永。",
["安永已聯繫周怡安親屬,協助辦理簽證相關事宜,周怡安家屬1月1日晚間搭乘東方航空班機抵達上海,他們步入入境大廳時神情落寞、不發一語。", "周怡安來自台中,去年剛從元智大學畢業,同年9月加入安永。"]),
("我们明天一起去看《摔跤吧!爸爸》好吗?好!",
["我们明天一起去看《摔跤吧!爸爸》好吗?", "好!"... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_danish.py | test_da_sbd | assert | variable | 105 | import pytest
import pysbd
GOLDEN_DA_RULES_TEST_CASES = [
("Hej Verden. Mit navn er Jonas.",
["Hej Verden.", "Mit navn er Jonas."]),
("Hvad er dit navn? Mit nav er Jonas.",
["Hvad er dit navn?", "Mit nav er Jonas."]),
("There it is! I found it.",
["There it is!", "I found it."]),
("My name is Jonas E. Smith.",
["M... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_deutsch.py | test_de_sbd | assert | variable | 88 | import pytest
import pysbd
GOLDEN_DE_RULES_TEST_CASES = [
("„Ich habe heute keine Zeit“, sagte die Frau und flüsterte leise: „Und auch keine Lust.“ Wir haben 1.000.000 Euro.",
["„Ich habe heute keine Zeit“, sagte die Frau und flüsterte leise: „Und auch keine Lust.“", "Wir haben 1.000.000 Euro."]),
("Es gibt jedoch ei... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_dutch.py | test_nl_sbd | assert | variable | 17 | import pytest
GOLDEN_NL_RULES_TEST_CASES = [
("Hij schoot op de JP8-brandstof toen de Surface-to-Air (sam)-missiles op hem af kwamen. 81 procent van de schoten was raak.",
["Hij schoot op de JP8-brandstof toen de Surface-to-Air (sam)-missiles op hem af kwamen.", "81 procent van de schoten was raak."]),
("... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_english.py | test_en_sbd | assert | variable | 169 | import pytest
GOLDEN_EN_RULES_TEST_CASES = [
("Hello World. My name is Jonas.", ["Hello World.", "My name is Jonas."]),
("What is your name? My name is Jonas.", ["What is your name?", "My name is Jonas."]),
("There it is! I found it.", ["There it is!", "I found it."]),
("My name is Jonas E. Smith.", ["... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_english_clean.py | test_en_sbd_with_clean | assert | variable | 600 | ("Differing agendas can potentially create an understanding gap in a consultation.11 12 Take the example of one of the most common presentations in ill health: the common cold.",
["Differing agendas can potentially create an understanding gap in a consultation.11 12", "Take the example of one of the... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_french.py | test_fr_sbd | assert | variable | 22 | import pytest
GOLDEN_FR_RULES_TEST_CASES = [
("Après avoir été l'un des acteurs du projet génome humain, le Genoscope met aujourd'hui le cap vers la génomique environnementale. L'exploitation des données de séquences, prolongée par l'identification expérimentale des fonctions biologiques, notamment dans le domaine de ... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_greek.py | test_el_sbd | assert | variable | 14 | import pytest
GOLDEN_EL_RULES_TEST_CASES = [
("Με συγχωρείτε· πού είναι οι τουαλέτες; Τις Κυριακές δε δούλευε κανένας. το κόστος του σπιτιού ήταν £260.950,00.",
["Με συγχωρείτε· πού είναι οι τουαλέτες;", "Τις Κυριακές δε δούλευε κανένας.", "το κόστος του σπιτιού ήταν £260.950,00."]),
]
@pytest.mark.parametrize('text... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_hindi.py | test_hi_sbd | assert | variable | 14 | import pytest
GOLDEN_HI_RULES_TEST_CASES = [
("सच्चाई यह है कि इसे कोई नहीं जानता। हो सकता है यह फ़्रेन्को के खिलाफ़ कोई विद्रोह रहा हो, या फिर बेकाबू हो गया कोई आनंदोत्सव।",
["सच्चाई यह है कि इसे कोई नहीं जानता।", "हो सकता है यह फ़्रेन्को के खिलाफ़ कोई विद्रोह रहा हो, या फिर बेकाबू हो गया कोई आनंदोत्सव।"])
]
... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_italian.py | test_it_sbd | assert | variable | 87 | import pytest
GOLDEN_IT_RULES_TEST_CASES = [
("Salve Sig.ra Mengoni! Come sta oggi?",
["Salve Sig.ra Mengoni!", "Come sta oggi?"]),
("Una lettera si può iniziare in questo modo «Il/la sottoscritto/a.».",
["Una lettera si può iniziare in questo modo «Il/la sottoscritto/a.»."]),
("La casa costa 170.500.000,00€!",
["L... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_japanese.py | test_ja_sbd | assert | variable | 20 | import pytest
GOLDEN_JA_RULES_TEST_CASES = [
("これはペンです。それはマーカーです。",
["これはペンです。", "それはマーカーです。"]),
("それは何ですか?ペンですか?",
["それは何ですか?", "ペンですか?"]),
("良かったね!すごい!",
["良かったね!", "すごい!"]),
("自民党税制調査会の幹部は、「引き下げ幅は3.29%以上を目指すことになる」と指摘していて、今後、公明党と合意したうえで、30日に決定する与党税制改正大綱に盛り込むことにしています。2%台後半を目指すとする方向で最終調整に入りました。",
["自民党税制調査会の幹部は、「引... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_kazakh.py | test_kk_sbd | assert | variable | 38 | import pytest
GOLDEN_KK_RULES_TEST_CASES = [
("Мұхитқа тікелей шыға алмайтын мемлекеттердің ішінде Қазақстан - ең үлкені.",
["Мұхитқа тікелей шыға алмайтын мемлекеттердің ішінде Қазақстан - ең үлкені."]),
("Оқушылар үйі, Достық даңғылы, Абай даналығы, ауыл шаруашылығы – кім? не?",
["Оқушылар үйі, Достық даңғылы, Аба... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_marathi.py | test_mr_sbd | assert | variable | 22 | import pytest
GOLDEN_MR_RULES_TEST_CASES = [
("आज दसरा आहे. आज खूप शुभ दिवस आहे.",
["आज दसरा आहे.", "आज खूप शुभ दिवस आहे."]),
("ढग खूप गर्जत होते; पण पाऊस पडत नव्हता.",
["ढग खूप गर्जत होते; पण पाऊस पडत नव्हता."]),
("रमाची परीक्षा कधी आहे? अवकाश आहे अजून.",
["रमाची परीक्षा कधी आहे?", "अवकाश आ... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_persian.py | test_fa_sbd | assert | variable | 14 | import pytest
GOLDEN_FA_RULES_TEST_CASES = [
("خوشبختم، آقای رضا. شما کجایی هستید؟ من از تهران هستم.",
["خوشبختم، آقای رضا.", "شما کجایی هستید؟", "من از تهران هستم."])
]
@pytest.mark.parametrize('text,expected_sents', GOLDEN_FA_RULES_TEST_CASES)
def test_fa_sbd(fa_default_fixture, text, expected_sents):
... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_polish.py | test_pl_sbd | assert | variable | 14 | import pytest
GOLDEN_PL_RULES_TEST_CASES = [
("To słowo bałt. jestskrótem.",
["To słowo bałt. jestskrótem."]),
]
@pytest.mark.parametrize('text,expected_sents', GOLDEN_PL_RULES_TEST_CASES)
def test_pl_sbd(pl_default_fixture, text, expected_sents):
"""Polish language SBD tests"""
segments = pl_default_fixture... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_russian.py | test_ru_sbd | assert | variable | 97 | import pytest
GOLDEN_RU_RULES_TEST_CASES = [
("Объем составляет 5 куб.м.",
["Объем составляет 5 куб.м."]),
("Маленькая девочка бежала и кричала: «Не видали маму?».",
["Маленькая девочка бежала и кричала: «Не видали маму?»."]),
("Сегодня 27.10.14", ["Сегодня 27.10.14"])
]
RU_MORE_TEST_CASES = [("Маленькая девочка бе... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_spanish.py | test_es_sbd | assert | variable | 102 | import pytest
import pysbd
GOLDEN_ES_RULES_TEST_CASES = [
("¿Cómo está hoy? Espero que muy bien.",
["¿Cómo está hoy?", "Espero que muy bien."]),
("¡Hola señorita! Espero que muy bien.",
["¡Hola señorita!", "Espero que muy bien."]),
("Hola Srta. Ledesma. Buenos días, soy el Lic. Naser Pastoriza, y... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/lang/test_urdu.py | test_ur_sbd | assert | variable | 14 | import pytest
GOLDEN_UR_RULES_TEST_CASES = [
("کیا حال ہے؟ ميرا نام ___ ەے۔ میں حالا تاوان دےدوں؟",
["کیا حال ہے؟", "ميرا نام ___ ەے۔", "میں حالا تاوان دےدوں؟"]),
]
@pytest.mark.parametrize('text,expected_sents', GOLDEN_UR_RULES_TEST_CASES)
def test_ur_sbd(ur_default_fixture, text, expected_sents):
"""Urdu langu... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/regression/test_issues.py | test_issue | assert | variable | 77 | import pytest
import pysbd
from pysbd.utils import TextSpan
TEST_ISSUE_DATA = [
('#27', "This new form of generalized PDF in (9) is generic and suitable for all the fading models presented in Table I withbranches MRC reception. In section III, (9) will be used in the derivations of the unified ABER and ACC express... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/regression/test_issues.py | test_issue | assert | string_literal | 79 | import pytest
import pysbd
from pysbd.utils import TextSpan
TEST_ISSUE_DATA = [
('#27', "This new form of generalized PDF in (9) is generic and suitable for all the fading models presented in Table I withbranches MRC reception. In section III, (9) will be used in the derivations of the unified ABER and ACC express... | " ".join(segments) | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/regression/test_issues.py | test_issues_with_char_spans | assert | variable | 78 | import pytest
import pysbd
from pysbd.utils import TextSpan
TEST_ISSUE_DATA = [
('#27', "This new form of generalized PDF in (9) is generic and suitable for all the fading models presented in Table I withbranches MRC reception. In section III, (9) will be used in the derivations of the unified ABER and ACC express... | expected_text_spans | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/regression/test_issues.py | test_issues_with_char_spans | assert | string_literal | 80 | import pytest
import pysbd
from pysbd.utils import TextSpan
TEST_ISSUE_DATA = [
('#27', "This new form of generalized PDF in (9) is generic and suitable for all the fading models presented in Table I withbranches MRC reception. In section III, (9) will be used in the derivations of the unified ABER and ACC express... | "".join([seg.sent for seg in segments]) | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_cleaner.py | test_cleaner_none_input | assert | variable | 14 | import pytest
from pysbd.cleaner import Cleaner
from pysbd.languages import Language
TEST_TOBE_CLEANED_DATA = [
("It was a cold \nnight in the city.", "It was a cold night in the city."),
("This is the U.S. Senate my friends. <em>Yes.</em> <em>It is</em>!",
"This is the U.S. Senate my friends. Yes. It is!"... | text | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_cleaner.py | test_cleaner | assert | variable | 16 | import pytest
from pysbd.cleaner import Cleaner
from pysbd.languages import Language
TEST_TOBE_CLEANED_DATA = [
("It was a cold \nnight in the city.", "It was a cold night in the city."),
("This is the U.S. Senate my friends. <em>Yes.</em> <em>It is</em>!",
"This is the U.S. Senate my friends. Yes. It is!"... | expected_cleaned_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_cleaner.py | test_cleaner_doesnt_mutate_input | assert | string_literal | 14 | import pytest
from pysbd.cleaner import Cleaner
from pysbd.languages import Language
TEST_TOBE_CLEANED_DATA = [
("It was a cold \nnight in the city.", "It was a cold night in the city."),
("This is the U.S. Senate my friends. <em>Yes.</em> <em>It is</em>!",
"This is the U.S. Senate my friends. Yes. It is!"... | "It was a cold \nnight in the city." | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_languages.py | test_exception_on_no_lang_code_provided | pytest.raises | variable | 6 | import pytest
from pysbd.languages import LANGUAGE_CODES, Language
def test_exception_on_no_lang_code_provided():
with pytest.raises( | ValueError) | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_languages.py | test_exception_on_no_lang_code_provided | assert | func_call | 8 | import pytest
from pysbd.languages import LANGUAGE_CODES, Language
def test_exception_on_no_lang_code_provided():
with pytest.raises(ValueError) as e:
Language.get_language_code('')
assert "Provide valid language ID i.e. ISO code." in | str(e.value) | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_languages.py | test_lang_code2instance_mapping | assert | variable | 7 | import pytest
from pysbd.languages import LANGUAGE_CODES, Language
def test_lang_code2instance_mapping():
for code, language_module in LANGUAGE_CODES.items():
assert Language.get_language_code(code) == | language_module | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_segmenter.py | test_no_input | assert | collection | 8 | import pytest
import pysbd
from pysbd.utils import TextSpan
def test_no_input(pysbd_default_en_no_clean_no_span_fixture, text=""):
segments = pysbd_default_en_no_clean_no_span_fixture.segment(text)
assert segments == | [] | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_segmenter.py | test_exception_with_both_clean_and_span_true | pytest.raises | variable | 9 | import pytest
import pysbd
from pysbd.utils import TextSpan
def test_exception_with_both_clean_and_span_true():
"""Test to not allow clean=True and char_span=True
"""
with pytest.raises( | ValueError) | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_segmenter.py | test_en_pdf_type | assert | variable | 12 | import pytest
import pysbd
from pysbd.utils import TextSpan
@pytest.mark.parametrize('text,expected_sents', PDF_TEST_DATA)
def test_en_pdf_type(text, expected_sents):
"""SBD tests from Pragmatic Segmenter for doctype:pdf"""
seg = pysbd.Segmenter(language="en", clean=True, doc_type='pdf')
segments = seg.seg... | expected_sents | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_segmenter.py | test_sbd_char_span | assert | variable | 18 | import pytest
import pysbd
from pysbd.utils import TextSpan
@pytest.mark.parametrize('text,expected',
[('My name is Jonas E. Smith. Please turn to p. 55.',
[
('My name is Jonas E. Smith. ', 0, 27),
('Pl... | expected_text_spans | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_segmenter.py | test_sbd_char_span | assert | string_literal | 20 | import pytest
import pysbd
from pysbd.utils import TextSpan
@pytest.mark.parametrize('text,expected',
[('My name is Jonas E. Smith. Please turn to p. 55.',
[
('My name is Jonas E. Smith. ', 0, 27),
('Pl... | "".join([seg.sent for seg in segments]) | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_segmenter.py | test_same_sentence_different_char_span | assert | string_literal | 30 | import pytest
import pysbd
from pysbd.utils import TextSpan
def test_same_sentence_different_char_span(en_no_clean_with_span_fixture):
"""Test same sentences with different char offsets & check for non-destruction"""
text = """From the AP comes this story :
President Bush on Tuesday nominated two individuals t... | "".join([seg.sent for seg in segments_w_spans]) | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_segmenter.py | test_segmenter_doesnt_mutate_input | assert | string_literal | 10 | import pytest
import pysbd
from pysbd.utils import TextSpan
def test_segmenter_doesnt_mutate_input(pysbd_default_en_no_clean_no_span_fixture,
text='My name is Jonas E. Smith. Please turn to p. 55.'):
segments = pysbd_default_en_no_clean_no_span_fixture.segment(text)
segme... | 'My name is Jonas E. Smith. Please turn to p. 55.' | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nipunsadvilkar/pySBD | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | train | train | tests/test_segmenter.py | test_exception_with_both_clean_and_span_true | assert | string_literal | 13 | import pytest
import pysbd
from pysbd.utils import TextSpan
def test_exception_with_both_clean_and_span_true():
"""Test to not allow clean=True and char_span=True
"""
with pytest.raises(ValueError) as e:
seg = pysbd.Segmenter(language="en", clean=True, char_span=True)
text = "<h2 class=\"li... | "char_span must be False if clean is True. "\ "Since `clean=True` will modify original text." | 90699972c8b5cd63c7fa4581419250e60b15db87 | 12 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/plugins/matcher/matcher_process.py | receive | assert | variable | 26 | from nonebot import on_message
from nonebot.matcher import Matcher
from nonebot.adapters import Event, Message
from nonebot.params import ArgStr, Received, EventMessage, LastReceived
test_handle = on_message()
async def handle():
await test_handle.finish("send", at_sender=True)
async def got(key1: str = ArgStr()... | y | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/plugins/matcher/matcher_process.py | got | assert | string_literal | 18 | from nonebot import on_message
from nonebot.matcher import Matcher
from nonebot.adapters import Event, Message
from nonebot.params import ArgStr, Received, EventMessage, LastReceived
test_handle = on_message()
async def handle():
await test_handle.finish("send", at_sender=True)
@test_got.got("key1", "prompt key1... | "text" | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/plugins/matcher/matcher_process.py | got | assert | string_literal | 19 | from nonebot import on_message
from nonebot.matcher import Matcher
from nonebot.adapters import Event, Message
from nonebot.params import ArgStr, Received, EventMessage, LastReceived
test_handle = on_message()
async def handle():
await test_handle.finish("send", at_sender=True)
@test_got.got("key1", "prompt key1... | "text_next" | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/plugins/param/param_depend.py | parameterless | assert | numeric_literal | 20 | from typing import Annotated
from dataclasses import dataclass
from pydantic import Field
from nonebot import on_message
from nonebot.adapters import Bot
from nonebot.params import Depends
test_depends = on_message()
runned = []
def dependency():
runned.append(1)
return 1
def parameterless():
assert ... | 0 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/plugins/param/param_exception.py | exc | assert | variable | 5 | from typing import Union
async def exc(e: Exception, x: Union[ValueError, TypeError]) -> Exception:
assert e == | x | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_adapter.py | test_adapter_connect | assert | variable | 44 | from typing import Optional
from contextlib import asynccontextmanager
import pytest
from nonebug import App
from utils import FakeAdapter
from nonebot.adapters import Bot
from nonebot.drivers import (
URL,
Driver,
Request,
Response,
WebSocket,
HTTPServerSetup,
WebSocketServerSetup,
)
@py... | bot | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_adapter.py | test_adapter_server | assert | variable | 80 | from typing import Optional
from contextlib import asynccontextmanager
import pytest
from nonebug import App
from utils import FakeAdapter
from nonebot.adapters import Bot
from nonebot.drivers import (
URL,
Driver,
Request,
Response,
WebSocket,
HTTPServerSetup,
WebSocketServerSetup,
)
@py... | setup | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_adapter.py | test_adapter_http_client | assert | variable | 64 | from typing import Optional
from contextlib import asynccontextmanager
import pytest
from nonebug import App
from utils import FakeAdapter
from nonebot.adapters import Bot
from nonebot.drivers import (
URL,
Driver,
Request,
Response,
WebSocket,
HTTPServerSetup,
WebSocketServerSetup,
)
@py... | request | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_adapter.py | test_adapter_websocket_client | assert | variable | 68 | from typing import Optional
from contextlib import asynccontextmanager
import pytest
from nonebug import App
from utils import FakeAdapter
from nonebot.adapters import Bot
from nonebot.drivers import (
URL,
Driver,
Request,
Response,
WebSocket,
HTTPServerSetup,
WebSocketServerSetup,
)
@py... | _fake_ws | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_adapter.py | test_adapter_connect | assert | complex_expr | 45 | from typing import Optional
from contextlib import asynccontextmanager
import pytest
from nonebug import App
from utils import FakeAdapter
from nonebot.adapters import Bot
from nonebot.drivers import (
URL,
Driver,
Request,
Response,
WebSocket,
HTTPServerSetup,
WebSocketServerSetup,
)
@py... | adapter.bots | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_bot.py | test_bot_call_api | assert | bool_literal | 17 | from typing import Any, Optional
import pytest
from nonebug import App
from nonebot.adapters import Bot
from nonebot.exception import MockApiException
@pytest.mark.asyncio
async def test_bot_call_api(app: App):
async with app.test_api() as ctx:
bot = ctx.create_bot()
ctx.should_call_api("test", {... | True | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_bot.py | test_bot_calling_api_hook_mock | assert | bool_literal | 34 | from typing import Any, Optional
import pytest
from nonebug import App
from nonebot.adapters import Bot
from nonebot.exception import MockApiException
@pytest.mark.asyncio
async def test_bot_calling_api_hook_mock(app: App):
runned: bool = False
async def calling_api_hook(bot: Bot, api: str, data: dict[str, ... | False | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_bot.py | test_bot_called_api_hook_simple | assert | collection | 31 | from typing import Any, Optional
import pytest
from nonebug import App
from nonebot.adapters import Bot
from nonebot.exception import MockApiException
@pytest.mark.asyncio
async def test_bot_called_api_hook_simple(app: App):
runned: bool = False
async def called_api_hook(
bot: Bot,
exception... | {called_api_hook} | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_bot.py | test_bot_calling_api_hook_simple | assert | collection | 25 | from typing import Any, Optional
import pytest
from nonebug import App
from nonebot.adapters import Bot
from nonebot.exception import MockApiException
@pytest.mark.asyncio
async def test_bot_calling_api_hook_simple(app: App):
runned: bool = False
async def calling_api_hook(bot: Bot, api: str, data: dict[str... | {calling_api_hook} | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_bot.py | test_bot_call_api | pytest.raises | complex_expr | 22 | from typing import Any, Optional
import pytest
from nonebug import App
from nonebot.adapters import Bot
from nonebot.exception import MockApiException
@pytest.mark.asyncio
async def test_bot_call_api(app: App):
async with app.test_api() as ctx:
bot = ctx.create_bot()
ctx.should_call_api("test", {... | RuntimeError, match="test") | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_segment_data | assert | numeric_literal | 10 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_segment_data():
assert len(FakeMessageSegment.text("text")) == | 4 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_message_getitem | assert | numeric_literal | 32 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_message_getitem():
message = FakeMessage(
[
FakeMessageSegment.text("test"),
... | 0 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_message_getitem | assert | numeric_literal | 33 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_message_getitem():
message = FakeMessage(
[
FakeMessageSegment.text("test"),
... | 1 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_message_getitem | assert | numeric_literal | 39 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_message_getitem():
message = FakeMessage(
[
FakeMessageSegment.text("test"),
... | 2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_segment_copy | assert | variable | 12 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_segment_copy():
origin = FakeMessageSegment.text("text")
copy = origin.copy()
assert origin is... | copy | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_message_contains | assert | bool_literal | 19 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_message_contains():
message = FakeMessage(
[
FakeMessageSegment.text("test"),
... | True | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_message_contains | assert | bool_literal | 24 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_message_contains():
message = FakeMessage(
[
FakeMessageSegment.text("test"),
... | False | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_message_validate | assert | func_call | 10 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_message_validate():
assert type_validate_python(FakeMessage, FakeMessage([])) == | FakeMessage([]) | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_segment_data | assert | collection | 11 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_segment_data():
assert len(FakeMessageSegment.text("text")) == 4
assert FakeMessageSegment.text("t... | {"text": "text"} | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_segment_data | assert | collection | 12 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_segment_data():
assert len(FakeMessageSegment.text("text")) == 4
assert FakeMessageSegment.text("te... | ["type", "data"] | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_message.py | test_segment_validate | pytest.raises | variable | 14 | import pytest
from pydantic import ValidationError
from nonebot.compat import type_validate_python
from utils import FakeMessage, FakeMessageSegment
from nonebot.adapters import Message, MessageSegment
def test_segment_validate():
assert type_validate_python(
FakeMessageSegment,
{"type": "text", "... | ValidationError) | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_template.py | test_malformed_template | assert | string_literal | 10 | import pytest
from nonebot.adapters import MessageTemplate
from utils import FakeMessage, FakeMessageSegment, escape_text
def test_malformed_template():
positive_template = FakeMessage.template("{a}{b}")
message = positive_template.format(a="a", b="b")
assert message.extract_plain_text() == | "ab" | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_template.py | test_template_basis | assert | string_literal | 10 | import pytest
from nonebot.adapters import MessageTemplate
from utils import FakeMessage, FakeMessageSegment, escape_text
def test_template_basis():
template = MessageTemplate("{key:.3%}")
formatted = template.format(key=0.123456789)
assert formatted == | "12.346%" | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_template.py | test_template_message | assert | variable | 25 | import pytest
from nonebot.adapters import MessageTemplate
from utils import FakeMessage, FakeMessageSegment, escape_text
def test_template_message():
template = FakeMessage.template("{a:custom}{b:text}{c:image}/{d}")
@template.add_format_spec
def custom(input: str) -> str:
return f"{input}-custo... | formatted | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_template.py | test_template_message | assert | string_literal | 26 | import pytest
from nonebot.adapters import MessageTemplate
from utils import FakeMessage, FakeMessageSegment, escape_text
def test_template_message():
template = FakeMessage.template("{a:custom}{b:text}{c:image}/{d}")
@template.add_format_spec
def custom(input: str) -> str:
return f"{input}-custo... | "custom-custom!text/114" | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_template.py | test_rich_template_message | assert | func_call | 18 | import pytest
from nonebot.adapters import MessageTemplate
from utils import FakeMessage, FakeMessageSegment, escape_text
def test_rich_template_message():
pic1, pic2, pic3 = (
FakeMessageSegment.image("file:///pic1.jpg"),
FakeMessageSegment.image("file:///pic2.jpg"),
FakeMessageSegment.im... | FakeMessage([pic1, pic2, pic3]) | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_template.py | test_message_injection | assert | func_call | 11 | import pytest
from nonebot.adapters import MessageTemplate
from utils import FakeMessage, FakeMessageSegment, escape_text
def test_message_injection():
template = FakeMessage.template("{name}Is Bad")
message = template.format(name="[fake:image]")
assert message.extract_plain_text() == | escape_text("[fake:image]Is Bad") | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_template.py | test_template_message | pytest.raises | complex_expr | 14 | import pytest
from nonebot.adapters import MessageTemplate
from utils import FakeMessage, FakeMessageSegment, escape_text
def test_template_message():
template = FakeMessage.template("{a:custom}{b:text}{c:image}/{d}")
@template.add_format_spec
def custom(input: str) -> str:
return f"{input}-custo... | ValueError, match="already exists") | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_template.py | test_template_message | assert | string_literal | 27 | import pytest
from nonebot.adapters import MessageTemplate
from utils import FakeMessage, FakeMessageSegment, escape_text
def test_template_message():
template = FakeMessage.template("{a:custom}{b:text}{c:image}/{d}")
@template.add_format_spec
def custom(input: str) -> str:
return f"{input}-custo... | "custom-custom!text[fake:image]/114" | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_template.py | test_malformed_template | pytest.raises | complex_expr | 13 | import pytest
from nonebot.adapters import MessageTemplate
from utils import FakeMessage, FakeMessageSegment, escape_text
def test_malformed_template():
positive_template = FakeMessage.template("{a}{b}")
message = positive_template.format(a="a", b="b")
assert message.extract_plain_text() == "ab"
malf... | ValueError, match="private attribute") | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_adapters/test_template.py | test_rich_template_message | assert | string_literal | 19 | import pytest
from nonebot.adapters import MessageTemplate
from utils import FakeMessage, FakeMessageSegment, escape_text
def test_rich_template_message():
pic1, pic2, pic3 = (
FakeMessageSegment.image("file:///pic1.jpg"),
FakeMessageSegment.image("file:///pic2.jpg"),
FakeMessageSegment.im... | "[fake:image]" + escape_text("[fake:image]") + "[fake:image]" + "[fake:image]" | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_broadcast.py | test_event_preprocessor_exception | assert | func_call | 68 | import sys
from typing import Optional
import pytest
from nonebug import App
from nonebot import on_message
import nonebot.message as message
from utils import make_fake_event
from nonebot.params import Depends
from nonebot.typing import T_State
from nonebot.matcher import Matcher
from nonebot.adapters import Bot, Ev... | capsys.readouterr().out | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_broadcast.py | test_run_preprocessor | assert | collection | 48 | import sys
from typing import Optional
import pytest
from nonebug import App
from nonebot import on_message
import nonebot.message as message
from utils import make_fake_event
from nonebot.params import Depends
from nonebot.typing import T_State
from nonebot.matcher import Matcher
from nonebot.adapters import Bot, Ev... | { dependent.call for dependent in message._run_preprocessors } | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
nonebot/nonebot2 | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | train | train | tests/test_broadcast.py | test_run_postprocessor | assert | collection | 49 | import sys
from typing import Optional
import pytest
from nonebug import App
from nonebot import on_message
import nonebot.message as message
from utils import make_fake_event
from nonebot.params import Depends
from nonebot.typing import T_State
from nonebot.matcher import Matcher
from nonebot.adapters import Bot, Ev... | { dependent.call for dependent in message._run_postprocessors } | f5f5d93b64108278934d4237d0cbe6c547b9cd3e | 84 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.