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 |
|---|---|---|---|---|---|---|---|---|---|
inducer/loopy | __copyright__ = "Copyright (C) 2018 Kaushik Kulkarni"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, m... | 1) | assert_* | numeric_literal | test/test_callables.py | test_call_kernel_w_preds | 1,279 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2015 James Stevens"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modi... | 3 | assert | numeric_literal | test/test_statistics.py | test_no_loop_ops | 1,532 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2021-25 Kaushik Kulkarni"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy... | 2 | assert | numeric_literal | test/test_loop_fusion.py | test_loop_fusion_with_loop_independent_deps | 156 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2019 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | ary.dtype | assert | complex_expr | test/test_expression.py | test_real_with_real_argument | 587 | null | |
inducer/loopy | __copyright__ = """
Copyright (C) 2012 Andreas Kloeckner
Copyright (C) 2016, 2017 Matt Wala
"""
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including wit... | len(actual) | assert | func_call | test/test_scan.py | check_segmented_scan_output | 368 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | code | assert | variable | test/test_domain.py | test_assume | 52 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2015 James Stevens"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modi... | 2 | assert | numeric_literal | test/test_statistics.py | test_all_counters_parallel_matmul | 1,082 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2019 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | np.abs(f32)) | assert_* | func_call | test/test_expression.py | test_complex_functions_with_real_args | 690 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | lp.generate_code_v2(knl).device_code() | assert | func_call | test/test_apps.py | test_unsigned_types_to_mod | 680 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2016 Matt Wala"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, ... | LoopyKeyBuilder()(reconst_knl) | assert | func_call | test/test_misc.py | test_kernel_pickling_and_hashing | 42 | null | |
inducer/loopy | from __future__ import annotations
__copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without ... | arg_desc.ref_shape | assert | complex_expr | loopy/auto_test.py | make_args | 252 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | 7. | assert | numeric_literal | test/test_target.py | test_pyopencl_execution_numpy_handling | 337 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2015 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | lp.generate_code_v2(t_unit).device_code() | assert | func_call | test/test_fortran.py | test_assign_double_precision_scalar | 84 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2019 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | 0) | assert_* | numeric_literal | test/test_expression.py | test_complex_support | 560 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2017 Nick Curtis"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify... | lp.generate_code_v2(knl).host_code() | assert | func_call | test/test_c_execution.py | test_c_execution_with_global_temporaries | 289 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2019 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | np.real(ary.get())) | assert_* | func_call | test/test_expression.py | test_real_with_real_argument | 588 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2016 Matt Wala"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, ... | lst1 | assert | variable | test/test_misc.py | test_lazily_unpickling_list_eq_and_persistent_hashing | 212 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2019 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | -1) | assert_* | numeric_literal | test/test_expression.py | test_complex_support | 557 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | flatten((4*i + 6*j + 3*k) // 12) | assert | func_call | test/test_isl.py | test_qpolynomrial_to_expr | 111 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | (0,) | assert | collection | test/test_target.py | test_zero_size_temporaries | 653 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | 2 | assert | numeric_literal | test/test_apps.py | test_domain_tree_nesting | 648 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2016 Matt Wala"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, ... | Optional() | assert | func_call | test/test_misc.py | test_optional | 265 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | "0 if i == 0 else -1 + i" | assert | string_literal | test/test_isl.py | test_pw_aff_to_conditional_expr | 50 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2015 James Stevens"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modi... | 400 | assert | numeric_literal | test/test_statistics.py | test_stats_on_callable_kernel | 1,459 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | x[i] | assert | complex_expr | test/test_loopy.py | test_sep_array_ordering | 3,278 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | 5 | assert | numeric_literal | test/test_reduction.py | test_reduction_without_inames | 481 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | 1e-16 | assert | numeric_literal | test/test_transform.py | test_add_barrier | 204 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2021-25 Kaushik Kulkarni"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy... | 1 | assert | numeric_literal | test/test_loop_fusion.py | test_loop_fusion_vanilla | 89 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | 4 | assert | numeric_literal | test/test_transform.py | test_uniquify_instruction_ids | 596 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2018 Kaushik Kulkarni"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, m... | 1e-15 | assert | numeric_literal | test/test_callables.py | test_register_function_lookup | 61 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | 3 | assert | numeric_literal | test/test_loopy.py | test_regression_no_ret_call_removal | 1,604 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2019 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | np.abs(c64)) | assert_* | func_call | test/test_expression.py | test_complex_functions_with_real_args | 682 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | 0 | assert | numeric_literal | test/test_loopy.py | test_creation_kwargs | 3,446 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | "unr" | assert | string_literal | test/test_transform.py | test_tag_iname_with_match_pattern | 1,184 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2019 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | 2 | assert | numeric_literal | test/test_expression.py | test_divide_precedence | 508 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | code | assert | variable | test/test_loopy.py | test_type_inference_no_artificial_doubles | 113 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2022 University of Illinois Board of Trustees"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation th... | 2 | assert | numeric_literal | test/test_tree.py | test_tree_simple | 38 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | code.index("for") | assert | func_call | test/test_reduction.py | test_reduction_with_conditional | 442 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2018 Kaushik Kulkarni"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, m... | np.sin(10)) | assert_* | func_call | test/test_callables.py | test_symbol_mangler_in_call | 773 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | ref | assert | variable | test/test_reduction.py | test_simul_reduce | 336 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2015 James Stevens"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modi... | 2*n*m | assert | complex_expr | test/test_statistics.py | test_mem_access_counter_nonconsec | 799 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2017 Nick Curtis"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify... | 42 | assert | numeric_literal | test/test_c_execution.py | test_one_length_loop | 356 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | 10 | assert | numeric_literal | test/test_loopy.py | test_unschedulable_kernel_detection | 1,594 | null | |
inducer/loopy | __copyright__ = """
Copyright (C) 2012 Andreas Kloeckner
Copyright (C) 2016, 2017 Matt Wala
"""
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including wit... | cgr.device_code() | assert | func_call | test/test_scan.py | test_automatic_scan_detection | 113 | null | |
inducer/loopy | __copyright__ = "Copyright (C) 2019 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, ... | var_values | assert | variable | test/test_expression.py | make_random_int_expression | 141 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pypinyin.constants import Style
from pypinyin.converter import DefaultConverter
def test_pre_handle_nopinyin_return_value():
class A(DefaultConverter):
def pre_handle_nopinyin(self, chars, style, heteronym, errors,
strict, **kwar... | [['abc']] | assert | collection | tests/test_converter.py | test_pre_handle_nopinyin_return_value | 42 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin, Style, lazy_pinyin, slug
from pypinyin.seg.simpleseg import simple_seg
def test_issue_266():
assert lazy_pinyin('哟', style=Style.FINALS) == ['o']
assert lazy_pinyin('哟', style=Style.FINALS, strict=False) == ['o']
... | [''] | assert | collection | tests/test_others.py | test_issue_266 | 47 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import sys
from pypinyin.compat import SUPPORT_UCS4
from pypinyin import runner
from pypinyin.tools import toneconvert
from pytest import mark
def test_runner_default():
options = runner.get_parser().parse_args(['你好'])
assert options.func == 'pinyin'
assert options... | 'zh4ao' | assert | string_literal | tests/test_cmd.py | test_runner_default | 24 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import sys
from pypinyin.compat import SUPPORT_UCS4
from pypinyin import runner
from pypinyin.tools import toneconvert
from pytest import mark
def test_runner_custom():
options = runner.get_parser().parse_args([
'--func', 'slug', '--style', 'zhao', '--separator', ' ... | 'zhao' | assert | string_literal | tests/test_cmd.py | test_runner_custom | 36 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import pinyin, load_phrases_dict
from pypinyin.contrib import mmseg
seg_test = mmseg.Seg(mmseg.PrefixSet())
seg_test._prefix_set.train([
'a',
'ab',
'abc',
'abcd',
'abd',
'ac',
'acd',
'aff',
'agf',
'agfgef',
... | ['金'] | assert | collection | tests/contrib/test_mmseg.py | test_phrases | 142 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin_dict
from pypinyin.contrib.tone_convert import (
tone_to_normal,
tone_to_tone2,
tone2_to_tone,
tone_to_tone3,
tone3_to_tone,
tone2_to_normal,
tone2_to_tone3,
tone3_to_tone2,
tone3_to_normal,
... | 'ǘ' | assert | string_literal | tests/contrib/test_tone_convert.py | test_issue_290_2 | 436 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from copy import deepcopy
from pypinyin import pinyin, Style
from pypinyin.style import register, convert
def test_issue_291():
assert pinyin('誒', style=Style.TONE, heteronym=True) == \
[['éi', 'xī', 'yì', 'ê̄', 'ế', 'ê̌', 'ěi',
'ề', 'èi', 'ēi']]
... | [['ㄟˊ', 'ㄒㄧ', 'ㄧˋ', 'ㄝ', 'ㄝˊ', 'ㄝˇ', 'ㄟˇ', 'ㄝˋ', 'ㄟˋ', 'ㄟ']] | assert | collection | tests/test_style.py | test_issue_291 | 66 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin, Style, lazy_pinyin, slug
from pypinyin.seg.simpleseg import simple_seg
def test_issue_311():
assert lazy_pinyin('大城', style=Style.TONE2) == ['da | ['da4', 'che2ng'] | assert | collection | tests/test_others.py | test_issue_311 | 55 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import pinyin, load_phrases_dict
from pypinyin.contrib import mmseg
seg_test = mmseg.Seg(mmseg.PrefixSet())
seg_test._prefix_set.train([
'a',
'ab',
'abc',
'abcd',
'abd',
'ac',
'acd',
'aff',
'agf',
'agfgef',
... | ['啊啊啊'] | assert | collection | tests/contrib/test_mmseg.py | test_retrain | 112 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pypinyin.constants import Style
from pypinyin.core import (
Pinyin, to_fixed, handle_nopinyin, single_pinyin, phrase_pinyin)
def test_use_pre_seg_to_skip_seg():
class A(Pinyin):
def pre_seg(self, hans, **kwargs):
return ['a', 'b', 'c']
mypi... | [['cè'], ['shì']] | assert | collection | tests/test_core_cls.py | test_use_pre_seg_to_skip_seg | 16 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import (
pinyin, slug, lazy_pinyin, load_single_dict,
load_phrases_dict, NORMAL, TONE, TONE2, TONE3, INITIALS,
FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3,
BOPOMOFO, BOPOMOFO_FIRST, CYRILLIC, CYRILLIC_FIRST, Style
)
... | ['ju2'] | assert | collection | tests/test_pinyin.py | test_custom_pinyin_dict | 169 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import (
pinyin, slug, lazy_pinyin, load_single_dict,
load_phrases_dict, NORMAL, TONE, TONE2, TONE3, INITIALS,
FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3,
BOPOMOFO, BOPOMOFO_FIRST, CYRILLIC, CYRILLIC_FIRST, Style
)
... | [['ḿ']] | assert | collection | tests/test_pinyin.py | test_m4 | 533 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import pinyin, load_phrases_dict
from pypinyin.contrib import mmseg
seg_test = mmseg.Seg(mmseg.PrefixSet())
seg_test._prefix_set.train([
'a',
'ab',
'abc',
'abcd',
'abd',
'ac',
'acd',
'aff',
'agf',
'agfgef',
... | expect | assert | variable | tests/contrib/test_mmseg.py | test_mmseg | 75 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pypinyin.constants import Style
from pypinyin.converter import DefaultConverter
def test_pre_handle_nopinyin_return_value():
class A(DefaultConverter):
def pre_handle_nopinyin(self, chars, style, heteronym, errors,
strict, **kwar... | [['test']] | assert | collection | tests/test_converter.py | test_pre_handle_nopinyin_return_value | 40 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import copy
import os
import sys
import pytest
def cleanup():
_clean()
try:
yield
finally:
_clean()
def _clean():
for module in copy.copy(sys.modules):
if module.startswith('pypinyin'):
sys.modules.pop(module, None)
def te... | ['北京'] | assert | collection | tests/test_env.py | test_env | 36 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import pinyin, load_phrases_dict
from pypinyin.contrib import mmseg
seg_test = mmseg.Seg(mmseg.PrefixSet())
seg_test._prefix_set.train([
'a',
'ab',
'abc',
'abcd',
'abd',
'ac',
'acd',
'aff',
'agf',
'agfgef',
... | mmseg_ret | assert | variable | tests/contrib/test_mmseg.py | test_mmseg_for_pinyin | 88 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin_dict
from pypinyin.contrib.tone_convert import (
tone_to_normal,
tone_to_tone2,
tone2_to_tone,
tone_to_tone3,
tone3_to_tone,
tone2_to_normal,
tone2_to_tone3,
tone3_to_tone2,
tone3_to_normal,
... | 'ǘn' | assert | string_literal | tests/contrib/test_tone_convert.py | test_issue_290_3 | 467 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from itertools import chain
import pytest
from pypinyin import (
lazy_pinyin, pinyin, NORMAL, TONE, TONE2, TONE3, INITIALS,
FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3,
pinyin_dict, Style
)
from pypinyin.compat import SUPPORT_UCS4, PY2
from pypiny... | [result] | assert | collection | tests/test_standard.py | test_finals | 101 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin_dict
from pypinyin.contrib.tone_convert import (
tone_to_normal,
tone_to_tone2,
tone2_to_tone,
tone_to_tone3,
tone3_to_tone,
tone2_to_normal,
tone2_to_tone3,
tone3_to_tone2,
tone3_to_normal,
... | 'lv' | assert | string_literal | tests/contrib/test_tone_convert.py | test_issue_290_2 | 422 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin_dict
from pypinyin.contrib.tone_convert import (
tone_to_normal,
tone_to_tone2,
tone2_to_tone,
tone_to_tone3,
tone3_to_tone,
tone2_to_normal,
tone2_to_tone3,
tone3_to_tone2,
tone3_to_normal,
... | 'lü' | assert | string_literal | tests/contrib/test_tone_convert.py | test_issue_290_2 | 423 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pypinyin.constants import Style
from pypinyin.core import (
Pinyin, to_fixed, handle_nopinyin, single_pinyin, phrase_pinyin)
def test_handle_nopinyin_for_compatibly():
assert handle_nopinyin('test') == | [['test']] | assert | collection | tests/test_core_cls.py | test_handle_nopinyin_for_compatibly | 50 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import copy
import os
import sys
import pytest
def cleanup():
_clean()
try:
yield
finally:
_clean()
def _clean():
for module in copy.copy(sys.modules):
if module.startswith('pypinyin'):
sys.modules.pop(module, None)
def te... | {} | assert | collection | tests/test_env.py | test_env | 35 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin_dict
from pypinyin.contrib.tone_convert import (
tone_to_normal,
tone_to_tone2,
tone2_to_tone,
tone_to_tone3,
tone3_to_tone,
tone2_to_normal,
tone2_to_tone3,
tone3_to_tone2,
tone3_to_normal,
... | 'v' | assert | string_literal | tests/contrib/test_tone_convert.py | test_issue_290_2 | 433 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import sys
from pypinyin.compat import SUPPORT_UCS4
from pypinyin import runner
from pypinyin.tools import toneconvert
from pytest import mark
def test_runner_custom():
options = runner.get_parser().parse_args([
'--func', 'slug', '--style', 'zhao', '--separator', ' ... | 'ignore' | assert | string_literal | tests/test_cmd.py | test_runner_custom | 38 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from copy import deepcopy
from pypinyin import pinyin, Style
from pypinyin.style import register, convert
def test_issue_291():
assert pinyin('誒', style=Style.TONE, heteronym=True) == \
[['éi', 'xī', 'yì', 'ê̄', 'ế', 'ê̌', 'ěi',
'ề', 'èi', 'ēi']]
... | [['āi', 'ǎi', 'ê̄', 'ế', 'ê̌', 'ề', 'xiè', 'éi', 'ěi', 'èi', 'ēi']] | assert | collection | tests/test_style.py | test_issue_291 | 70 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from itertools import chain
import pytest
from pypinyin import (
lazy_pinyin, pinyin, NORMAL, TONE, TONE2, TONE3, INITIALS,
FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3,
pinyin_dict, Style
)
from pypinyin.compat import SUPPORT_UCS4, PY2
from pypiny... | result | assert | variable | tests/test_standard.py | test_initials | 48 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from copy import deepcopy
from pypinyin import pinyin, Style
from pypinyin.style import register, convert
def test_issue_291():
assert pinyin('誒', style=Style.TONE, heteronym=True) == \
[['éi', 'xī', 'yì', 'ê̄', 'ế', 'ê̌', 'ěi',
'ề', 'èi', 'ēi']]
... | [['ㄞ', 'ㄞˇ', 'ㄝ', 'ㄝˊ', 'ㄝˇ', 'ㄝˋ', 'ㄒㄧㄝˋ', 'ㄟˊ', 'ㄟˇ', 'ㄟˋ', 'ㄟ']] | assert | collection | tests/test_style.py | test_issue_291 | 73 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import lazy_pinyin, Style
from pypinyin.contrib.neutral_tone import NeutralToneWith5Mixin
from pypinyin.contrib.uv import V2UMixin
from pypinyin.converter import DefaultConverter
from pypinyin.core import Pinyin
@mark.parametrize('input,st... | expected_old | assert | variable | tests/contrib/test_neutral_tone.py | test_neutral_tone_with_5_many_cases | 95 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import (
pinyin, slug, lazy_pinyin, load_single_dict,
load_phrases_dict, NORMAL, TONE, TONE2, TONE3, INITIALS,
FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3,
BOPOMOFO, BOPOMOFO_FIRST, CYRILLIC, CYRILLIC_FIRST, Style
)
... | [[han]] | assert | collection | tests/test_pinyin.py | test_dont_support_ucs4 | 422 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin_dict
from pypinyin.contrib.tone_convert import (
tone_to_normal,
tone_to_tone2,
tone2_to_tone,
tone_to_tone3,
tone3_to_tone,
tone2_to_normal,
tone2_to_tone3,
tone3_to_tone2,
tone3_to_normal,
... | 'lün' | assert | string_literal | tests/contrib/test_tone_convert.py | test_issue_290_3 | 454 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import sys
from pypinyin.compat import SUPPORT_UCS4
from pypinyin import runner
from pypinyin.tools import toneconvert
from pytest import mark
def test_runner_custom():
options = runner.get_parser().parse_args([
'--func', 'slug', '--style', 'zhao', '--separator', ' ... | 'slug' | assert | string_literal | tests/test_cmd.py | test_runner_custom | 35 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin, Style, lazy_pinyin, slug
from pypinyin.seg.simpleseg import simple_seg
def test_issue_205():
assert pinyin('金融行业', Style.FIRST_LETTER)[2] == ['h'] | ['h'] | assert | collection | tests/test_others.py | test_issue_205 | 37 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from copy import deepcopy
from pypinyin import pinyin, Style
from pypinyin.style import register, convert
def test_finals_tone3_no_final():
assert convert('ń', Style.FINALS_TONE3, True, None) == ' | '' | assert | string_literal | tests/test_style.py | test_finals_tone3_no_final | 58 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import sys
from pypinyin.compat import SUPPORT_UCS4
from pypinyin import runner
from pypinyin.tools import toneconvert
from pytest import mark
@mark.parametrize('args,output', [
[['to-normal', 'yí,yì'], ['yi,yi', '\n']],
[['to-tone', 'yi2,yi4'], ['yí,yì', '\n']],
[[... | output | assert | variable | tests/test_cmd.py | test_toneconvert_default | 58 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import pinyin, load_phrases_dict
from pypinyin.contrib import mmseg
seg_test = mmseg.Seg(mmseg.PrefixSet())
seg_test._prefix_set.train([
'a',
'ab',
'abc',
'abcd',
'abd',
'ac',
'acd',
'aff',
'agf',
'agfgef',
... | ['银行'] | assert | collection | tests/contrib/test_mmseg.py | test_phrases | 137 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import lazy_pinyin
from pypinyin.constants import Style
from pypinyin.contrib.tone_sandhi import ToneSandhiMixin
from pypinyin.converter import DefaultConverter
from pypinyin.core import Pinyin
@mark.parametrize('han,normal_output, sandhi_... | sandhi_output | assert | variable | tests/contrib/test_tone_sandhi.py | test_tone_sandhi | 64 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin, Style, lazy_pinyin, slug
from pypinyin.seg.simpleseg import simple_seg
def test_simple_seg():
assert simple_seg('啦啦') == ['啦啦']
assert simple_seg('啦啦abc') == ['啦啦', 'abc']
assert simple_seg('&##啦啦abc') == ['&##',... | ['哦', 'ほ#'] | assert | collection | tests/test_others.py | test_simple_seg | 23 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import pinyin, load_phrases_dict
from pypinyin.contrib import mmseg
seg_test = mmseg.Seg(mmseg.PrefixSet())
seg_test._prefix_set.train([
'a',
'ab',
'abc',
'abcd',
'abd',
'ac',
'acd',
'aff',
'agf',
'agfgef',
... | ['啊', '啊', '啊'] | assert | collection | tests/contrib/test_mmseg.py | test_retrain | 108 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import sys
from pypinyin.compat import SUPPORT_UCS4
from pypinyin import runner
from pypinyin.tools import toneconvert
from pytest import mark
def test_runner_default():
options = runner.get_parser().parse_args(['你好'])
assert options.func == 'pinyin'
assert options.... | '-' | assert | string_literal | tests/test_cmd.py | test_runner_default | 25 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin, Style, lazy_pinyin, slug
from pypinyin.seg.simpleseg import simple_seg
def test_simple_seg():
assert simple_seg('啦啦') == ['啦啦 | ['啦啦'] | assert | collection | tests/test_others.py | test_simple_seg | 19 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin_dict
from pypinyin.contrib.tone_convert import (
tone_to_normal,
tone_to_tone2,
tone2_to_tone,
tone_to_tone3,
tone3_to_tone,
tone2_to_normal,
tone2_to_tone3,
tone3_to_tone2,
tone3_to_normal,
... | 'ü' | assert | string_literal | tests/contrib/test_tone_convert.py | test_issue_290_2 | 434 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin.contrib._tone_rule import right_mark_index
@mark.parametrize('input,expected', [
['da', 1],
['shuai', 3],
['guang', 2],
['zai', 1],
['po', 1],
['tou', 1],
['qiong', 2],
['ge', 1],
['jie', 2],
['ten... | expected | assert | variable | tests/contrib/test_tone_rule.py | test_right_mark_index | 46 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import (
pinyin, slug, lazy_pinyin, load_single_dict,
load_phrases_dict, NORMAL, TONE, TONE2, TONE3, INITIALS,
FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3,
BOPOMOFO, BOPOMOFO_FIRST, CYRILLIC, CYRILLIC_FIRST, Style
)
... | pys | assert | variable | tests/test_pinyin.py | test_36 | 428 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from itertools import chain
import pytest
from pypinyin import (
lazy_pinyin, pinyin, NORMAL, TONE, TONE2, TONE3, INITIALS,
FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3,
pinyin_dict, Style
)
from pypinyin.compat import SUPPORT_UCS4, PY2
from pypiny... | result[0] | assert | complex_expr | tests/test_standard.py | test_initials | 50 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import lazy_pinyin, Style
from pypinyin.contrib.neutral_tone import NeutralToneWith5Mixin
from pypinyin.contrib.uv import V2UMixin
from pypinyin.converter import DefaultConverter
from pypinyin.core import Pinyin
@mark.parametrize('input,st... | expected_new | assert | variable | tests/contrib/test_neutral_tone.py | test_neutral_tone_with_5_many_cases | 96 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import sys
from pypinyin.compat import SUPPORT_UCS4
from pypinyin import runner
from pypinyin.tools import toneconvert
from pytest import mark
def test_runner_default():
options = runner.get_parser().parse_args(['你好'])
assert options.func == | 'pinyin' | assert | string_literal | tests/test_cmd.py | test_runner_default | 23 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin_dict
from pypinyin.contrib.tone_convert import (
tone_to_normal,
tone_to_tone2,
tone2_to_tone,
tone_to_tone3,
tone3_to_tone,
tone2_to_normal,
tone2_to_tone3,
tone3_to_tone2,
tone3_to_normal,
... | py | assert | variable | tests/contrib/test_tone_convert.py | test_tone_to_tone2_tone3_to_tone | 355 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pypinyin.constants import Style
from pypinyin.core import (
Pinyin, to_fixed, handle_nopinyin, single_pinyin, phrase_pinyin)
def test_single_pinyin_for_compatibly():
assert single_pinyin('测', Style.TONE, False) == [[ | [['cè']] | assert | collection | tests/test_core_cls.py | test_single_pinyin_for_compatibly | 54 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import pinyin, load_phrases_dict
from pypinyin.contrib import mmseg
seg_test = mmseg.Seg(mmseg.PrefixSet())
seg_test._prefix_set.train([
'a',
'ab',
'abc',
'abcd',
'abd',
'ac',
'acd',
'aff',
'agf',
'agfgef',
... | [] | assert | collection | tests/contrib/test_mmseg.py | test_phrases | 140 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin_dict
from pypinyin.contrib.tone_convert import (
tone_to_normal,
tone_to_tone2,
tone2_to_tone,
tone_to_tone3,
tone3_to_tone,
tone2_to_normal,
tone2_to_tone3,
tone3_to_tone2,
tone3_to_normal,
... | 'ün' | assert | string_literal | tests/contrib/test_tone_convert.py | test_issue_290_1 | 399 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import pinyin, load_phrases_dict
from pypinyin.contrib import mmseg
seg_test = mmseg.Seg(mmseg.PrefixSet())
seg_test._prefix_set.train([
'a',
'ab',
'abc',
'abcd',
'abd',
'ac',
'acd',
'aff',
'agf',
'agfgef',
... | ['男孩儿'] | assert | collection | tests/contrib/test_mmseg.py | test_retrain | 114 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import pytest
from pypinyin import (
pinyin, slug, lazy_pinyin, load_single_dict,
load_phrases_dict, NORMAL, TONE, TONE2, TONE3, INITIALS,
FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3,
BOPOMOFO, BOPOMOFO_FIRST, CYRILLIC, CYRILLIC_FIRST, Style
)
... | ret | assert | variable | tests/test_pinyin.py | test_simple_seg | 260 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from pytest import mark
from pypinyin import pinyin_dict
from pypinyin.contrib.tone_convert import (
tone_to_normal,
tone_to_tone2,
tone2_to_tone,
tone_to_tone3,
tone3_to_tone,
tone2_to_normal,
tone2_to_tone3,
tone3_to_tone2,
tone3_to_normal,
... | 'lvn' | assert | string_literal | tests/contrib/test_tone_convert.py | test_issue_290_3 | 453 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
import sys
from pypinyin.compat import SUPPORT_UCS4
from pypinyin import runner
from pypinyin.tools import toneconvert
from pytest import mark
def test_runner_default():
options = runner.get_parser().parse_args(['你好'])
assert options.func == 'pinyin'
assert options.... | 'default' | assert | string_literal | tests/test_cmd.py | test_runner_default | 28 | null | |
mozillazg/python-pinyin | from __future__ import unicode_literals
from itertools import chain
import pytest
from pypinyin import (
lazy_pinyin, pinyin, NORMAL, TONE, TONE2, TONE3, INITIALS,
FIRST_LETTER, FINALS, FINALS_TONE, FINALS_TONE2, FINALS_TONE3,
pinyin_dict, Style
)
from pypinyin.compat import SUPPORT_UCS4, PY2
from pypiny... | _FINALS | assert | variable | tests/test_standard.py | test_ensure_finails_in_strict_mode | 610 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.