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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_helpers.py | test_to_similarity | assert | func_call | 42 | import pytest
from symspellpy.helpers import (
case_transfer_matching,
case_transfer_similar,
is_acronym,
to_similarity,
)
def get_acronyms():
return [
("ABCDE", {"default": True, "digits": True}),
("AB12E", {"default": True, "digits": True}),
("abcde", {"default": False, "... | to_similarity(6.0, length) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_helpers.py | test_to_similarity | assert | func_call | 43 | import pytest
from symspellpy.helpers import (
case_transfer_matching,
case_transfer_similar,
is_acronym,
to_similarity,
)
def get_acronyms():
return [
("ABCDE", {"default": True, "digits": True}),
("AB12E", {"default": True, "digits": True}),
("abcde", {"default": False, "... | to_similarity(-1.0, length) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_helpers.py | test_case_transfer_similar_empty_wo_casing | assert | func_call | 44 | import pytest
from symspellpy.helpers import (
case_transfer_matching,
case_transfer_similar,
is_acronym,
to_similarity,
)
def get_acronyms():
return [
("ABCDE", {"default": True, "digits": True}),
("AB12E", {"default": True, "digits": True}),
("abcde", {"default": False, "... | case_transfer_similar(cased_text, uncased_text) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_helpers.py | test_case_transfer_matching | assert | func_call | 46 | import pytest
from symspellpy.helpers import (
case_transfer_matching,
case_transfer_similar,
is_acronym,
to_similarity,
)
def get_acronyms():
return [
("ABCDE", {"default": True, "digits": True}),
("AB12E", {"default": True, "digits": True}),
("abcde", {"default": False, "... | case_transfer_matching( cased_text, uncased_text ) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_suggest_item.py | test_suggest_item | assert | variable | 16 | import pytest
from symspellpy.suggest_item import SuggestItem
def suggest_item():
return SuggestItem("term", 0, 0)
class TestSuggestItem:
def test_suggest_item(self):
si_1 = SuggestItem("asdf", 12, 34)
si_2 = SuggestItem("sdfg", 12, 34)
si_3 = SuggestItem("dfgh", 56, 78)
as... | si_2 | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_suggest_item.py | test_suggest_item | assert | variable | 17 | import pytest
from symspellpy.suggest_item import SuggestItem
def suggest_item():
return SuggestItem("term", 0, 0)
class TestSuggestItem:
def test_suggest_item(self):
si_1 = SuggestItem("asdf", 12, 34)
si_2 = SuggestItem("sdfg", 12, 34)
si_3 = SuggestItem("dfgh", 56, 78)
ass... | si_3 | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_suggest_item.py | test_suggest_item | assert | complex_expr | 19 | import pytest
from symspellpy.suggest_item import SuggestItem
def suggest_item():
return SuggestItem("term", 0, 0)
class TestSuggestItem:
def test_suggest_item(self):
si_1 = SuggestItem("asdf", 12, 34)
si_2 = SuggestItem("sdfg", 12, 34)
si_3 = SuggestItem("dfgh", 56, 78)
ass... | si_1.term | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_suggest_item.py | test_suggest_item | assert | func_call | 27 | import pytest
from symspellpy.suggest_item import SuggestItem
def suggest_item():
return SuggestItem("term", 0, 0)
class TestSuggestItem:
def test_suggest_item(self):
si_1 = SuggestItem("asdf", 12, 34)
si_2 = SuggestItem("sdfg", 12, 34)
si_3 = SuggestItem("dfgh", 56, 78)
ass... | str(si_1) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_suggest_item.py | test_invalid_less_than | pytest.raises | variable | 13 | import pytest
from symspellpy.suggest_item import SuggestItem
def suggest_item():
return SuggestItem("term", 0, 0)
class TestSuggestItem:
def test_invalid_less_than(self, suggest_item):
assert suggest_item.__lt__(0) is NotImplemented
with pytest.raises( | TypeError) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_suggest_item.py | test_invalid_equal_to | assert | variable | 11 | import pytest
from symspellpy.suggest_item import SuggestItem
def suggest_item():
return SuggestItem("term", 0, 0)
class TestSuggestItem:
def test_invalid_equal_to(self, suggest_item):
assert suggest_item.__eq__(0) is | NotImplemented | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_suggest_item.py | test_invalid_less_than | assert | func_call | 15 | import pytest
from symspellpy.suggest_item import SuggestItem
def suggest_item():
return SuggestItem("term", 0, 0)
class TestSuggestItem:
def test_invalid_less_than(self, suggest_item):
assert suggest_item.__lt__(0) is NotImplemented
with pytest.raises(TypeError) as excinfo:
sugg... | str( excinfo.value ) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy.py | test_negative_max_dictionary_edit_distance | pytest.raises | variable | 36 | from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
from symspellpy.helpers import DictIO
FORTESTS_DIR = Path(__file__).resolve().parent / "fortests"
BAD_DICT_PATH = FORTESTS_DIR / "bad_dict.txt"
BIG_MODIFIED_PATH = FORTESTS_DIR / "big_modified.txt"
BIG_WORDS_PATH = FORTESTS_DIR / "big_... | ValueError) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy.py | test_load_dictionary_encoding | assert | func_call | 40 | from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
from symspellpy.helpers import DictIO
FORTESTS_DIR = Path(__file__).resolve().parent / "fortests"
BAD_DICT_PATH = FORTESTS_DIR / "bad_dict.txt"
BIG_MODIFIED_PATH = FORTESTS_DIR / "big_modified.txt"
BIG_WORDS_PATH = FORTESTS_DIR / "big_... | len(result) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy.py | test_load_dictionary_encoding | assert | complex_expr | 41 | from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
from symspellpy.helpers import DictIO
FORTESTS_DIR = Path(__file__).resolve().parent / "fortests"
BAD_DICT_PATH = FORTESTS_DIR / "bad_dict.txt"
BIG_MODIFIED_PATH = FORTESTS_DIR / "big_modified.txt"
BIG_WORDS_PATH = FORTESTS_DIR / "big_... | result[0].term | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy.py | test_add_additional_counts_should_increase_count | assert | complex_expr | 44 | from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
from symspellpy.helpers import DictIO
FORTESTS_DIR = Path(__file__).resolve().parent / "fortests"
BAD_DICT_PATH = FORTESTS_DIR / "bad_dict.txt"
BIG_MODIFIED_PATH = FORTESTS_DIR / "big_modified.txt"
BIG_WORDS_PATH = FORTESTS_DIR / "big_... | result[0].count | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy.py | test_negative_max_dictionary_edit_distance | assert | func_call | 38 | from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
from symspellpy.helpers import DictIO
FORTESTS_DIR = Path(__file__).resolve().parent / "fortests"
BAD_DICT_PATH = FORTESTS_DIR / "bad_dict.txt"
BIG_MODIFIED_PATH = FORTESTS_DIR / "big_modified.txt"
BIG_WORDS_PATH = FORTESTS_DIR / "big_... | str(excinfo.value) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup.py | test_should_replicate_noisy_results | assert | variable | 35 | import sys
from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
def symspell_high_thres():
return SymSpell(2, 7, 10)
def symspell_high_thres_flame(symspell_high_thres):
symspell_high_thres.create_dictionary_entry("flame", 20)
symspell_high_thres.create_dictionary_entry("flam... | result_sum | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup.py | test_deletes | assert | func_call | 25 | import sys
from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
def symspell_high_thres():
return SymSpell(2, 7, 10)
def symspell_high_thres_flame(symspell_high_thres):
symspell_high_thres.create_dictionary_entry("flame", 20)
symspell_high_thres.create_dictionary_entry("flam... | len(result) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup.py | test_max_edit_distance_too_large | pytest.raises | variable | 20 | import sys
from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
def symspell_high_thres():
return SymSpell(2, 7, 10)
def symspell_high_thres_flame(symspell_high_thres):
symspell_high_thres.create_dictionary_entry("flame", 20)
symspell_high_thres.create_dictionary_entry("flam... | ValueError) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup.py | test_deletes | assert | complex_expr | 26 | import sys
from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
def symspell_high_thres():
return SymSpell(2, 7, 10)
def symspell_high_thres_flame(symspell_high_thres):
symspell_high_thres.create_dictionary_entry("flame", 20)
symspell_high_thres.create_dictionary_entry("flam... | result[0].term | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup.py | test_words_with_shared_prefix_should_retain_counts | assert | complex_expr | 28 | import sys
from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
def symspell_high_thres():
return SymSpell(2, 7, 10)
def symspell_high_thres_flame(symspell_high_thres):
symspell_high_thres.create_dictionary_entry("flame", 20)
symspell_high_thres.create_dictionary_entry("flam... | result[1].term | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup.py | test_deletes | assert | complex_expr | 27 | import sys
from pathlib import Path
import pytest
from symspellpy import SymSpell, Verbosity
def symspell_high_thres():
return SymSpell(2, 7, 10)
def symspell_high_thres_flame(symspell_high_thres):
symspell_high_thres.create_dictionary_entry("flame", 20)
symspell_high_thres.create_dictionary_entry("flam... | result[0].count | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup_compound.py | test_lookup_compound_only_combi | assert | func_call | 13 | import pytest
class TestSymSpellPyLookupCompound:
@pytest.mark.parametrize(
"symspell_default_entry", [[("steam", 1), ("machine", 1)]], indirect=True
)
def test_lookup_compound_only_combi(self, symspell_default_entry):
typo = "ste am machie"
correction = "steam machine"
res... | len(results) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup_compound.py | test_lookup_compound_only_combi | assert | complex_expr | 14 | import pytest
class TestSymSpellPyLookupCompound:
@pytest.mark.parametrize(
"symspell_default_entry", [[("steam", 1), ("machine", 1)]], indirect=True
)
def test_lookup_compound_only_combi(self, symspell_default_entry):
typo = "ste am machie"
correction = "steam machine"
res... | results[0].term | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup_compound.py | test_lookup_compound_ignore_non_words_ignore_digits | assert | complex_expr | 26 | import pytest
class TestSymSpellPyLookupCompound:
@pytest.mark.parametrize(
"symspell_default_load", ["bigram", "unigram"], indirect=True
)
def test_lookup_compound_ignore_non_words_ignore_digits(
self, symspell_default_load
):
sym_spell, _ = symspell_default_load
typo... | results[0].count | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup_compound.py | test_lookup_compound_ignore_non_words_ignore_digits | assert | complex_expr | 25 | import pytest
class TestSymSpellPyLookupCompound:
@pytest.mark.parametrize(
"symspell_default_load", ["bigram", "unigram"], indirect=True
)
def test_lookup_compound_ignore_non_words_ignore_digits(
self, symspell_default_load
):
sym_spell, _ = symspell_default_load
typo... | results[0].distance | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup_compound.py | test_lookup_compound_replaced_words | assert | func_call | 22 | import pytest
class TestSymSpellPyLookupCompound:
@pytest.mark.parametrize(
"symspell_default_load, get_fortests_data",
[
("bigram", "lookup_compound_replaced_words_data.json"),
("unigram", "lookup_compound_replaced_words_data.json"),
],
indirect=True,
)... | len(sym_spell.replaced_words) | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_lookup_compound.py | test_lookup_compound_replaced_words | assert | complex_expr | 25 | import pytest
class TestSymSpellPyLookupCompound:
@pytest.mark.parametrize(
"symspell_default_load, get_fortests_data",
[
("bigram", "lookup_compound_replaced_words_data.json"),
("unigram", "lookup_compound_replaced_words_data.json"),
],
indirect=True,
)... | sym_spell.replaced_words[k].term | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_pickle.py | test_pickle | assert | complex_expr | 39 | import os
import pickle
from unittest import TestCase
import pytest
from symspellpy import SymSpell
class TestSymSpellPyPickle:
@pytest.mark.parametrize(
"symspell_default_load, is_compressed",
[("unigram", True), ("bigram", True), ("unigram", False), ("bigram", False)],
indirect=["symspe... | sym_spell_2.words | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_pickle.py | test_pickle | assert | complex_expr | 37 | import os
import pickle
from unittest import TestCase
import pytest
from symspellpy import SymSpell
class TestSymSpellPyPickle:
@pytest.mark.parametrize(
"symspell_default_load, is_compressed",
[("unigram", True), ("bigram", True), ("unigram", False), ("bigram", False)],
indirect=["symspe... | sym_spell_2.bigrams | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_pickle.py | test_pickle | assert | complex_expr | 38 | import os
import pickle
from unittest import TestCase
import pytest
from symspellpy import SymSpell
class TestSymSpellPyPickle:
@pytest.mark.parametrize(
"symspell_default_load, is_compressed",
[("unigram", True), ("bigram", True), ("unigram", False), ("bigram", False)],
indirect=["symspe... | sym_spell_2.deletes | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_pickle.py | test_pickle | assert | complex_expr | 40 | import os
import pickle
from unittest import TestCase
import pytest
from symspellpy import SymSpell
class TestSymSpellPyPickle:
@pytest.mark.parametrize(
"symspell_default_load, is_compressed",
[("unigram", True), ("bigram", True), ("unigram", False), ("bigram", False)],
indirect=["symspe... | sym_spell_2._max_length | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_pickle.py | test_pickle | assert | complex_expr | 27 | import os
import pickle
from unittest import TestCase
import pytest
from symspellpy import SymSpell
class TestSymSpellPyPickle:
@pytest.mark.parametrize(
"symspell_default_load, is_compressed",
[("unigram", True), ("bigram", True), ("unigram", False), ("bigram", False)],
indirect=["symspe... | sym_spell_2._prefix_length | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_word_segmentation.py | test_word_segmentation_apostrophe | assert | complex_expr | 20 | import pytest
from symspellpy import SymSpell
def symspell_edit_distance_load(dictionary_path, request):
sym_spell = SymSpell(request.param)
sym_spell.load_dictionary(dictionary_path, 0, 1)
return sym_spell, request.param
class TestSymSpellPyWordSegmentation:
@pytest.mark.parametrize("symspell_edit_... | result[1] | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mammothb/symspellpy | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | train | train | tests/test_symspellpy_word_segmentation.py | test_word_segmentation_ignore_token | assert | complex_expr | 17 | import pytest
from symspellpy import SymSpell
def symspell_edit_distance_load(dictionary_path, request):
sym_spell = SymSpell(request.param)
sym_spell.load_dictionary(dictionary_path, 0, 1)
return sym_spell, request.param
class TestSymSpellPyWordSegmentation:
@pytest.mark.parametrize("symspell_defaul... | result.corrected_string | d24a47606964e15f53c3de2f32c94c3be58eb188 | 43 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_repair_json_with_objects | assert | collection | 6 | from src.json_repair.json_repair import loads, repair_json
def test_repair_json_with_objects():
# Test with valid JSON strings
assert repair_json("[]", return_objects=True) == | [] | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_repair_json_with_objects | assert | collection | 7 | from src.json_repair.json_repair import loads, repair_json
def test_repair_json_with_objects():
# Test with valid JSON strings
assert repair_json("[]", return_objects=True) == []
assert repair_json("{}", return_objects=True) == | {} | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_multiple_jsons | assert | string_literal | 5 | from src.json_repair.json_repair import loads, repair_json
def test_multiple_jsons():
assert repair_json("[]{}") == | "[[], {}]" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_repair_json_with_objects | assert | collection | 18 | from src.json_repair.json_repair import loads, repair_json
def test_repair_json_with_objects():
# Test with valid JSON strings
assert repair_json("[]", return_objects=True) == []
assert repair_json("{}", return_objects=True) == {}
assert repair_json('{"key": true, "key2": false, "key3": null}', return_... | [1, 2, 3, 4] | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_valid_json | assert | string_literal | 13 | from src.json_repair.json_repair import loads, repair_json
def test_valid_json():
assert (
repair_json('{"name": "John", "age": 30, "city": "New York"}')
== '{"name": "John", "age": 30, "city": "New York"}'
)
assert repair_json('{"employees":["John", "Anna", "Peter"]} ') == '{"employees": [... | '{"key": ""}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_multiple_jsons | assert | string_literal | 6 | from src.json_repair.json_repair import loads, repair_json
def test_multiple_jsons():
assert repair_json("[]{}") == "[[], {}]"
assert repair_json("{}[]{}") == | "[{}, [], {}]" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_stream_stable | assert | string_literal | 9 | from src.json_repair.json_repair import loads, repair_json
def test_stream_stable():
# default: stream_stable = False
# When the json to be repaired is the accumulation of streaming json at a certain moment.
# The default repair result is unstable.
assert repair_json('{"key": "val\\', stream_stable=Fal... | '{"key": "val"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_stream_stable | assert | string_literal | 16 | from src.json_repair.json_repair import loads, repair_json
def test_stream_stable():
# default: stream_stable = False
# When the json to be repaired is the accumulation of streaming json at a certain moment.
# The default repair result is unstable.
assert repair_json('{"key": "val\\', stream_stable=Fal... | '{"key": "val\\n"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_stream_stable | assert | string_literal | 8 | from src.json_repair.json_repair import loads, repair_json
def test_stream_stable():
# default: stream_stable = False
# When the json to be repaired is the accumulation of streaming json at a certain moment.
# The default repair result is unstable.
assert repair_json('{"key": "val\\', stream_stable=Fa... | '{"key": "val\\\\"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_valid_json | assert | string_literal | 10 | from src.json_repair.json_repair import loads, repair_json
def test_valid_json():
assert (
repair_json('{"name": "John", "age": 30, "city": "New York"}')
== '{"name": "John", "age": 30, "city": "New York"}'
)
assert repair_json('{"employees":["John", "Anna", "Peter"]} ') == '{"employees": [... | '{"key": "value:value"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_valid_json | assert | string_literal | 16 | from src.json_repair.json_repair import loads, repair_json
def test_valid_json():
assert (
repair_json('{"name": "John", "age": 30, "city": "New York"}')
== '{"name": "John", "age": 30, "city": "New York"}'
)
assert repair_json('{"employees":["John", "Anna", "Peter"]} ') == '{"employees": [... | '{"key": "value\\u263a"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_valid_json | assert | string_literal | 17 | from src.json_repair.json_repair import loads, repair_json
def test_valid_json():
assert (
repair_json('{"name": "John", "age": 30, "city": "New York"}')
== '{"name": "John", "age": 30, "city": "New York"}'
)
assert repair_json('{"employees":["John", "Anna", "Peter"]} ') == '{"employees": [... | '{"key": "value\\nvalue"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_multiple_jsons | assert | string_literal | 12 | from src.json_repair.json_repair import loads, repair_json
def test_multiple_jsons():
assert repair_json("[]{}") == "[[], {}]"
assert repair_json("{}[]{}") == "[{}, [], {}]"
assert repair_json('{"key":"value"}[1,2,3,True]') == '[{"key": "value"}, [1, 2, 3, true]]'
assert (
repair_json('lorem ``... | '[{"key": "value_after"}]' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_ensure_ascii | assert | string_literal | 5 | from src.json_repair.json_repair import loads, repair_json
def test_ensure_ascii():
assert repair_json("{'test_中国人_ascii':'统一码'}", ensure_ascii=False) == '{"test_中国人_ | '{"test_中国人_ascii": "统一码"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_valid_json | assert | string_literal | 14 | from src.json_repair.json_repair import loads, repair_json
def test_valid_json():
assert (
repair_json('{"name": "John", "age": 30, "city": "New York"}')
== '{"name": "John", "age": 30, "city": "New York"}'
)
assert repair_json('{"employees":["John", "Anna", "Peter"]} ') == '{"employees": [... | '{"key1": {"key2": [1, 2, 3]}}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_stream_stable | assert | string_literal | 17 | from src.json_repair.json_repair import loads, repair_json
def test_stream_stable():
# default: stream_stable = False
# When the json to be repaired is the accumulation of streaming json at a certain moment.
# The default repair result is unstable.
assert repair_json('{"key": "val\\', stream_stable=Fal... | '{"key": "val\\n123,`key2:value2"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_multiple_jsons | assert | string_literal | 7 | from src.json_repair.json_repair import loads, repair_json
def test_multiple_jsons():
assert repair_json("[]{}") == "[[], {}]"
assert repair_json("{}[]{}") == "[{}, [], {}]"
assert repair_json('{"key":"value"}[1,2,3,True]') == | '[{"key": "value"}, [1, 2, 3, true]]' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_json_repair.py | test_repair_json_skip_json_loads | assert | collection | 9 | from src.json_repair.json_repair import loads, repair_json
def test_repair_json_skip_json_loads():
assert (
repair_json('{"key": true, "key2": false, "key3": null}', skip_json_loads=True)
== '{"key": true, "key2": false, "key3": null}'
)
asser | {"key": True, "key2": False, "key3": None} | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_array.py | test_parse_array | assert | collection | 5 | from src.json_repair.json_repair import repair_json
def test_parse_array():
assert repair_json("[]", return_objects=True) == | [] | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_array.py | test_parse_array_edge_cases | assert | string_literal | 8 | from src.json_repair.json_repair import repair_json
def test_parse_array_edge_cases():
assert repair_json("[{]") == "[{}]"
assert repair_json("[") == "[]"
assert repair_json('["') == "[]"
assert repair_json("]") == | "" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_array.py | test_parse_array_edge_cases | assert | string_literal | 6 | from src.json_repair.json_repair import repair_json
def test_parse_array_edge_cases():
assert repair_json("[{]") == "[{}]"
assert repair_json("[") == | "[]" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_array.py | test_parse_array_edge_cases | assert | string_literal | 5 | from src.json_repair.json_repair import repair_json
def test_parse_array_edge_cases():
assert repair_json("[{]") == | "[{}]" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_array.py | test_parse_array | assert | string_literal | 8 | from src.json_repair.json_repair import repair_json
def test_parse_array():
assert repair_json("[]", return_objects=True) == []
assert repair_json("[1, 2, 3, 4]", return_objects=True) == [1, 2, 3, 4]
assert repair_json("[", return_objects=True) == []
assert repair_json("[[1\n\n]") == | "[[1]]" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_array.py | test_parse_array_edge_cases | assert | string_literal | 9 | from src.json_repair.json_repair import repair_json
def test_parse_array_edge_cases():
assert repair_json("[{]") == "[{}]"
assert repair_json("[") == "[]"
assert repair_json('["') == "[]"
assert repair_json("]") == ""
assert repair_json("[1, 2, 3,") == | "[1, 2, 3]" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_array.py | test_parse_array | assert | collection | 6 | from src.json_repair.json_repair import repair_json
def test_parse_array():
assert repair_json("[]", return_objects=True) == []
assert repair_json("[1, 2, 3, 4]", return_objects=True) == | [1, 2, 3, 4] | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_boolean_or_null.py | test_parse_boolean_or_null | assert | string_literal | 5 | from src.json_repair.json_repair import repair_json
def test_parse_boolean_or_null():
assert repair_json("True", return_objects=True) == | "" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_boolean_or_null.py | test_parse_boolean_or_null | assert | none_literal | 10 | from src.json_repair.json_repair import repair_json
def test_parse_boolean_or_null():
assert repair_json("True", return_objects=True) == ""
assert repair_json("False", return_objects=True) == ""
assert repair_json("Null", return_objects=True) == ""
assert repair_json("true", return_objects=True)
as... | None | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_boolean_or_null.py | test_parse_boolean_or_null | assert | string_literal | 11 | from src.json_repair.json_repair import repair_json
def test_parse_boolean_or_null():
assert repair_json("True", return_objects=True) == ""
assert repair_json("False", return_objects=True) == ""
assert repair_json("Null", return_objects=True) == ""
assert repair_json("true", return_objects=True)
as... | '{"key": true, "key2": false, "key3": null}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_comment.py | test_parse_comment | assert | string_literal | 5 | from src.json_repair.json_repair import repair_json
def test_parse_comment():
assert repair_json("/") == | "" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_comment.py | test_parse_comment | assert | string_literal | 20 | from src.json_repair.json_repair import repair_json
def test_parse_comment():
assert repair_json("/") == ""
assert repair_json('/* comment */ {"key": "value"}')
assert (
repair_json('{ "key": { "key2": "value2" // comment }, "key3": "value3" }')
== '{"key": {"key2": "value2"}, "key3": "valu... | '{"key": "value"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_comment.py | test_parse_comment | assert | string_literal | 19 | from src.json_repair.json_repair import repair_json
def test_parse_comment():
assert repair_json("/") == ""
assert repair_json('/* comment */ {"key": "value"}')
assert (
repair_json('{ "key": { "key2": "value2" // comment }, "key3": "value3" }')
== '{"key": {"key2": "value2"}, "key3": "valu... | '["value", "value2"]' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_comment.py | test_parse_comment | assert | string_literal | 7 | from src.json_repair.json_repair import repair_json
def test_parse_comment():
assert repair_json("/") == ""
assert repair_json('/* comment */ {"key": "value"}')
assert | '{"key": {"key2": "value2"}, "key3": "value3"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_number.py | test_parse_number | assert | numeric_literal | 5 | from src.json_repair.json_repair import repair_json
def test_parse_number():
assert repair_json("1", return_objects=True) == | 1 | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_number.py | test_parse_number | assert | numeric_literal | 6 | from src.json_repair.json_repair import repair_json
def test_parse_number():
assert repair_json("1", return_objects=True) == 1
assert repair_json("1.2", return_objects=True) == | 1.2 | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_number.py | test_parse_number_edge_cases | assert | string_literal | 17 | from src.json_repair.json_repair import repair_json
def test_parse_number_edge_cases():
assert (
repair_json(' - { "test_key": ["test_value", "test_value2"] }') == '{"test_key": ["test_value", "test_value2"]}'
)
assert repair_json('{"key": 1/3}') == '{"key": "1/3"}'
assert repair_json('{"key": ... | "[]" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_number.py | test_parse_number_edge_cases | assert | string_literal | 12 | from src.json_repair.json_repair import repair_json
def test_parse_number_edge_cases():
assert (
repair_json(' - { "test_key": ["test_value", "test_value2"] }') == '{"test_key": ["test_value", "test_value2"]}'
)
assert repair_json('{"key": 1/3}') == '{"key": "1/3"}'
assert repair_json('{"key": ... | "[105, 12]" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_number.py | test_parse_number_edge_cases | assert | string_literal | 20 | from src.json_repair.json_repair import repair_json
def test_parse_number_edge_cases():
assert (
repair_json(' - { "test_key": ["test_value", "test_value2"] }') == '{"test_key": ["test_value", "test_value2"]}'
)
assert repair_json('{"key": 1/3}') == '{"key": "1/3"}'
assert repair_json('{"key": ... | '{"key": 1}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_number.py | test_parse_number_edge_cases | assert | string_literal | 18 | from src.json_repair.json_repair import repair_json
def test_parse_number_edge_cases():
assert (
repair_json(' - { "test_key": ["test_value", "test_value2"] }') == '{"test_key": ["test_value", "test_value2"]}'
)
assert repair_json('{"key": 1/3}') == '{"key": "1/3"}'
assert repair_json('{"key": ... | '{"key": 1.0}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_number.py | test_parse_number_edge_cases | assert | string_literal | 9 | from src.json_repair.json_repair import repair_json
def test_parse_number_edge_cases():
assert (
repair_json(' - { "test_key": ["test_value", "test_value2"] }') == '{"test_key": ["test_value", "test_value2"]}'
)
assert repair_json('{"key": 1/3}') == '{"key": "1/3"}'
assert repair_json('{"key":... | '{"key": 0.25}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_object.py | test_parse_object | assert | collection | 5 | from src.json_repair.json_repair import repair_json
def test_parse_object():
assert repair_json("{}", return_objects=True) == | {} | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_object.py | test_parse_object | assert | string_literal | 19 | from src.json_repair.json_repair import repair_json
def test_parse_object():
assert repair_json("{}", return_objects=True) == {}
assert repair_json('{ "key": "value", "key2": 1, "key3": True }', return_objects=True) == {
"key": "value",
"key2": 1,
"key3": True,
}
assert repair_j... | "" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_object.py | test_parse_object | assert | string_literal | 17 | from src.json_repair.json_repair import repair_json
def test_parse_object():
assert repair_json("{}", return_objects=True) == {}
assert repair_json('{ "key": "value", "key2": 1, "key3": True }', return_objects=True) == {
"key": "value",
"key2": 1,
"key3": True,
}
assert repair_j... | "{}" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_object.py | test_parse_object_edge_cases | assert | string_literal | 5 | from src.json_repair.json_repair import repair_json
def test_parse_object_edge_cases():
assert repair_json("{foo: [}") == | '{"foo": []}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_object.py | test_parse_object_edge_cases | assert | string_literal | 26 | from src.json_repair.json_repair import repair_json
def test_parse_object_edge_cases():
assert repair_json("{foo: [}") == '{"foo": []}'
assert repair_json("{ ") == "{}"
assert repair_json('{"": "value"') == '{"": "value"}'
assert repair_json('{"value_1": true, COMMENT "value_2": "data"}') == '{"v... | '{"a": "{ b"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_object.py | test_parse_object_edge_cases | assert | string_literal | 7 | from src.json_repair.json_repair import repair_json
def test_parse_object_edge_cases():
assert repair_json("{foo: [}") == '{"foo": []}'
assert repair_json("{ ") == "{}"
assert repair_json('{"": "value"') == | '{"": "value"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_object.py | test_parse_object_edge_cases | assert | string_literal | 27 | from src.json_repair.json_repair import repair_json
def test_parse_object_edge_cases():
assert repair_json("{foo: [}") == '{"foo": []}'
assert repair_json("{ ") == "{}"
assert repair_json('{"": "value"') == '{"": "value"}'
assert repair_json('{"value_1": true, COMMENT "value_2": "data"}') == '{"v... | '{"b": "xxxxx"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_parse_string | assert | string_literal | 5 | from src.json_repair.json_repair import repair_json
def test_parse_string():
assert repair_json('"') == | "" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_parse_string | assert | string_literal | 9 | from src.json_repair.json_repair import repair_json
def test_parse_string():
assert repair_json('"') == ""
assert repair_json("\n") == ""
assert repair_json(" ") == ""
assert repair_json("string") == ""
assert repair_json("stringbeforeobject {}") == | "{}" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_leading_trailing_characters | assert | string_literal | 7 | from src.json_repair.json_repair import repair_json
def test_leading_trailing_characters():
assert repair_json('````{ "key": "value" }```') == '{"key": "value"}'
assert repair_json("""{ "a": "", "b": [ { "c": 1} ] \n}```""") == '{"a": "", "b": [{"c": 1}]}'
assert | '{"a": "b"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_missing_and_mixed_quotes | assert | string_literal | 39 | from src.json_repair.json_repair import repair_json
def test_missing_and_mixed_quotes():
assert (
repair_json("{'key': 'string', 'key2': false, \"key3\": null, \"key4\": unquoted}")
== '{"key": "string", "key2": false, "key3": null, "key4": "unquoted"}'
)
assert (
repair_json('{"nam... | '{" key": "val"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_missing_and_mixed_quotes | assert | string_literal | 36 | from src.json_repair.json_repair import repair_json
def test_missing_and_mixed_quotes():
assert (
repair_json("{'key': 'string', 'key2': false, \"key3\": null, \"key4\": unquoted}")
== '{"key": "string", "key2": false, "key3": null, "key4": "unquoted"}'
)
assert (
repair_json('{"nam... | '{"key": "value"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_escaping | assert | string_literal | 13 | from src.json_repair.json_repair import repair_json
def test_escaping():
assert repair_json("'\"'") == ""
assert repair_json('{"key": \'string"\n\t\\le\'') == '{"key": "string\\"\\n\\t\\\\le"}'
assert (
repair_json(
r'{"real_content": "Some string: Some other string \t Some string <a hr... | '{"key_1": "value"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_missing_and_mixed_quotes | assert | string_literal | 38 | from src.json_repair.json_repair import repair_json
def test_missing_and_mixed_quotes():
assert (
repair_json("{'key': 'string', 'key2': false, \"key3\": null, \"key4\": unquoted}")
== '{"key": "string", "key2": false, "key3": null, "key4": "unquoted"}'
)
assert (
repair_json('{"nam... | '{"foo": "\\"bar\\""}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_escaping | assert | string_literal | 14 | from src.json_repair.json_repair import repair_json
def test_escaping():
assert repair_json("'\"'") == ""
assert repair_json('{"key": \'string"\n\t\\le\'') == '{"key": "string\\"\\n\\t\\\\le"}'
assert (
repair_json(
r'{"real_content": "Some string: Some other string \t Some string <a hr... | '{"key\\t_": "value"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_missing_and_mixed_quotes | assert | string_literal | 49 | from src.json_repair.json_repair import repair_json
def test_missing_and_mixed_quotes():
assert (
repair_json("{'key': 'string', 'key2': false, \"key3\": null, \"key4\": unquoted}")
== '{"key": "string", "key2": false, "key3": null, "key4": "unquoted"}'
)
assert (
repair_json('{"nam... | '{"key": "v\\"alu\\"e"}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_markdown | assert | string_literal | 9 | from src.json_repair.json_repair import repair_json
def test_markdown():
assert (
repair_json('{ "content": "[LINK]("https://google.com")" }')
== '{"content": "[LINK](\\"https://google.com\\")"}'
)
assert repair_json('{ "content": "[LINK](" }') == | '{"content": "[LINK]("}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_parse_string.py | test_leading_trailing_characters | assert | string_literal | 6 | from src.json_repair.json_repair import repair_json
def test_leading_trailing_characters():
assert repair_json('````{ "key": "value" }```') == '{"key": "value"}'
assert repair_json("""{ "a": "", "b": [ { "c": 1} ] \n}```""") == | '{"a": "", "b": [{"c": 1}]}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_performance.py | test_true_true_correct | assert | variable | 19 | import os.path
import pathlib
from src.json_repair import repair_json
path = pathlib.Path(__file__).parent.resolve()
def test_true_true_correct(benchmark):
benchmark(repair_json, correct_json, return_objects=True, skip_json_loads=True)
# Retrieve the median execution time
mean_time = benchmark.stats.get... | max_time | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_repair_json_cli.py | test_cli_inline_requires_filename | assert | numeric_literal | 17 | import io
import os
import tempfile
from unittest.mock import patch
import pytest
from src.json_repair.json_repair import cli
def test_cli_inline_requires_filename(capsys):
"""cli() should exit with an error when --inline is passed without a filename."""
with pytest.raises(SystemExit) as exc:
cli(inl... | 0 | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_repair_json_cli.py | test_cli_inline_requires_filename | pytest.raises | variable | 13 | import io
import os
import tempfile
from unittest.mock import patch
import pytest
from src.json_repair.json_repair import cli
def test_cli_inline_requires_filename(capsys):
"""cli() should exit with an error when --inline is passed without a filename."""
with pytest.raises( | SystemExit) | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_repair_json_cli.py | test_cli | assert | variable | 48 | import io
import os
import tempfile
from unittest.mock import patch
import pytest
from src.json_repair.json_repair import cli
def test_cli(capsys):
# Create a temporary file
temp_fd, temp_path = tempfile.mkstemp(suffix=".json")
try:
# Write content to the temporary file
with os.fdopen(tem... | expected_output | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_repair_json_cli.py | test_cli | assert | string_literal | 27 | import io
import os
import tempfile
from unittest.mock import patch
import pytest
from src.json_repair.json_repair import cli
def test_cli(capsys):
# Create a temporary file
temp_fd, temp_path = tempfile.mkstemp(suffix=".json")
try:
# Write content to the temporary file
with os.fdopen(tem... | '{\n"key": "value"\n}' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_repair_json_cli.py | test_cli | assert | string_literal | 20 | import io
import os
import tempfile
from unittest.mock import patch
import pytest
from src.json_repair.json_repair import cli
def test_cli(capsys):
# Create a temporary file
temp_fd, temp_path = tempfile.mkstemp(suffix=".json")
try:
# Write content to the temporary file
with os.fdopen(tem... | '{\n"key": "value"\n}\n' | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_repair_json_cli.py | test_cli_inline_requires_filename | assert | string_literal | 16 | import io
import os
import tempfile
from unittest.mock import patch
import pytest
from src.json_repair.json_repair import cli
def test_cli_inline_requires_filename(capsys):
"""cli() should exit with an error when --inline is passed without a filename."""
with pytest.raises(SystemExit) as exc:
cli(inl... | "Error: Inline mode requires a filename" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
mangiucugna/json_repair | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | train | train | tests/test_repair_json_cli.py | test_cli_inline_and_output_error | assert | string_literal | 17 | import io
import os
import tempfile
from unittest.mock import patch
import pytest
from src.json_repair.json_repair import cli
def test_cli_inline_and_output_error(tmp_path, capsys):
"""cli() should exit with an error when --inline and --output are used together."""
outfile = tmp_path / "out.json"
with py... | "Error: You cannot pass both --inline and --output" | 16e74a72b603baea38c0a22f78ec8d5f85eb6091 | 131 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.