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
xavctn/img2table
import polars as pl from img2table.tables.objects.cell import Cell from img2table.tables.processing.bordered_tables.cells.deduplication import deduplicate_cells def test_deduplicate_cells(): df_cells = pl.read_csv("test_data/expected_ident_cells.csv", separator=";", encoding="utf-8") cells = [Cell(x1=row["x1"...
sorted(expected, key=lambda c: (c.x1, c.y1, c.x2, c.y2))
assert
func_call
tests/tables/processing/bordered_tables/cells/test_deduplication_cells.py
test_deduplicate_cells
19
null
xavctn/img2table
from io import BytesIO import pytest from openpyxl import load_workbook from img2table.document.image import Image from img2table.ocr import TesseractOCR from img2table.tables.objects.extraction import BBox def test_no_ocr(): img = Image(src="test_data/dark.png", detect_rotation=True) result...
5
assert
numeric_literal
tests/document/image/test_image.py
test_no_ocr
92
null
xavctn/img2table
import json import os import polars as pl from img2table.document import Image from img2table.ocr import TextractOCR from img2table.ocr.data import OCRDataframe from tests import MOCK_DIR def test_map_response(mock_textract): img = Image("test_data/test.png") with open(os.path.join(MOCK_DIR, "textract.json"...
expected
assert
variable
tests/ocr/aws_textract/test_aws_textract.py
test_map_response
26
null
xavctn/img2table
import sys from io import BytesIO import pytest from img2table.document.pdf import PDF from img2table.ocr import TesseractOCR from img2table.tables.objects.extraction import BBox def test_pdf_tables(mock_tesseract): ocr = TesseractOCR() pdf = PDF(src="test_data/test.pdf") result = pdf.extract_tables(ocr...
(5, 4)
assert
collection
tests/document/pdf/test_pdf.py
test_pdf_tables
57
null
xavctn/img2table
from io import BytesIO import pytest from openpyxl import load_workbook from img2table.document.image import Image from img2table.ocr import TesseractOCR from img2table.tables.objects.extraction import BBox def test_no_ocr(): img = Image(src="test_data/dark.png", detect_rotation=True) result...
None
assert
none_literal
tests/document/image/test_image.py
test_no_ocr
89
null
xavctn/img2table
import json from img2table.tables.objects.cell import Cell from img2table.tables.processing.borderless_tables.model import ColumnGroup, Column, VerticalWS, Whitespace from img2table.tables.processing.borderless_tables.rows import \ identify_delimiter_group_rows, identify_row_delimiters, filter_coherent_row_delimit...
expected
assert
variable
tests/tables/processing/borderless_tables/rows/test_rows.py
test_identify_row_delimiters
24
null
xavctn/img2table
import json from img2table.tables.objects.cell import Cell from img2table.tables.processing.borderless_tables.model import ColumnGroup, Column, VerticalWS, Whitespace from img2table.tables.processing.borderless_tables.rows import \ identify_delimiter_group_rows, identify_row_delimiters, filter_coherent_row_delimit...
1233
assert
numeric_literal
tests/tables/processing/borderless_tables/rows/test_rows.py
test_identify_delimiter_group_rows
87
null
xavctn/img2table
import json from io import BytesIO from xlsxwriter import Workbook from img2table.tables.objects.cell import Cell from img2table.tables.objects.extraction import create_all_rectangles, CellPosition, TableCell, BBox, CellSpan from img2table.tables.objects.row import Row from img2table.tables.objects.table import Table...
[CellSpan(top_row=0, bottom_row=3, col_left=0, col_right=1, value='Test'), CellSpan(top_row=2, bottom_row=3, col_left=2, col_right=3, value='Test')]
assert
collection
tests/tables/objects/test_extraction.py
test_create_all_rectangles
25
null
xavctn/img2table
import cv2 from img2table.tables.image import TableImage def test_table_image(): image = cv2.cvtColor(cv2.imread("test_data/test.png"), cv2.COLOR_BGR2RGB) tb_image = TableImage(img=image, min_confidence=50) result = tb_image.extract_tables(implicit_rows=True) result = sorte...
(2, 2)
assert
collection
tests/tables/image/test_image.py
test_table_image
21
null
xavctn/img2table
from img2table.tables.objects.cell import Cell from img2table.tables.objects.line import Line from img2table.tables.processing.bordered_tables.tables.semi_bordered import get_lines_in_cluster, \ add_semi_bordered_cells, identify_table_dimensions, identify_potential_new_cells, update_cluster_cells def test_get_line...
[Line(x1=100, x2=100, y1=30, y2=270), Line(x1=200, x2=200, y1=30, y2=270)]
assert
collection
tests/tables/processing/bordered_tables/tables/test_semi_bordered.py
test_get_lines_in_cluster
20
null
xavctn/img2table
import json import polars as pl from img2table.document.pdf import PDF from img2table.ocr.data import OCRDataframe from img2table.ocr.pdf import PdfOCR def test_pdf_content(mock_tesseract): instance = PdfOCR() doc = PDF(src="test_data/test.pdf", pages=[0, 1]) result = instance.content(document=doc) ...
expected
assert
variable
tests/ocr/pdf/test_pdf_ocr.py
test_pdf_content
20
null
xavctn/img2table
import pickle import sys import polars as pl import pytest from img2table.document.image import Image from img2table.ocr import DocTR from img2table.ocr.data import OCRDataframe def format_content(content): output = { id_page: {id_line: [{"value": word.value, "confidence": ro...
format_content(expected)
assert
func_call
tests/ocr/doctr/test_doctr.py
test_doctr_content
39
null
xavctn/img2table
from io import BytesIO import pytest from openpyxl import load_workbook from img2table.document.image import Image from img2table.ocr import TesseractOCR from img2table.tables.objects.extraction import BBox def test_image_tables(mock_tesseract): ocr = TesseractOCR() img = Image(src="test_data/test.png", ...
6
assert
numeric_literal
tests/document/image/test_image.py
test_image_tables
72
null
xavctn/img2table
import json from img2table.tables.objects.cell import Cell from img2table.tables.processing.borderless_tables.model import ColumnGroup, VerticalWS, Column, Whitespace from img2table.tables.processing.borderless_tables.table.table_creation import get_table def test_get_table(): with open("test_data/delimiter_group...
17
assert
numeric_literal
tests/tables/processing/borderless_tables/table/test_table_creation.py
test_get_table
28
null
xavctn/img2table
import cv2 from img2table.tables.image import TableImage def test_table_image(): image = cv2.cvtColor(cv2.imread("test_data/test.png"), cv2.COLOR_BGR2RGB) tb_image = TableImage(img=image, min_confidence=50) result = tb_image.extract_tables(implicit_rows=True) result = sorte...
(36, 21, 770, 327)
assert
collection
tests/tables/image/test_image.py
test_table_image
17
null
xavctn/img2table
from img2table.tables.objects.cell import Cell from img2table.tables.objects.line import Line from img2table.tables.processing.bordered_tables.tables.semi_bordered import get_lines_in_cluster, \ add_semi_bordered_cells, identify_table_dimensions, identify_potential_new_cells, update_cluster_cells def test_identify...
sorted(expected, key=lambda c: c.bbox())
assert
func_call
tests/tables/processing/bordered_tables/tables/test_semi_bordered.py
test_identify_potential_new_cells
62
null
xavctn/img2table
from img2table.tables.objects.cell import Cell from img2table.tables.processing.borderless_tables.layout.table_segments import get_table_areas, coherent_table_areas, \ table_segment_from_group, get_table_segments from img2table.tables.processing.borderless_tables.model import ImageSegment, TableSegment, Whitespace ...
expected
assert
variable
tests/tables/processing/borderless_tables/layout/test_table_segments.py
test_get_table_areas
68
null
xavctn/img2table
import json from img2table.tables.objects.cell import Cell from img2table.tables.objects.row import Row from img2table.tables.objects.table import Table from img2table.tables.processing.bordered_tables.tables.implicit import implicit_content, implicit_rows_lines, \ implicit_columns_lines from img2table.tables.proc...
table.nb_columns + 8
assert
complex_expr
tests/tables/processing/bordered_tables/tables/test_implicit.py
test_implicit_content
72
null
xavctn/img2table
import sys from io import BytesIO import pytest from img2table.document.pdf import PDF from img2table.ocr import TesseractOCR from img2table.tables.objects.extraction import BBox def test_validators(): with pytest.raises(
TypeError)
pytest.raises
variable
tests/document/pdf/test_pdf.py
test_validators
13
null
xavctn/img2table
import json import cv2 from img2table.tables import threshold_dark_areas from img2table.tables.objects.line import Line from img2table.tables.processing.borderless_tables import segment_image def test_segment_image(): img = cv2.cvtColor(cv2.imread("test_data/test.bmp"), cv2.COLOR_BGR2RGB) thresh = threshold_...
2
assert
numeric_literal
tests/tables/processing/borderless_tables/layout/test_layout.py
test_segment_image
24
null
xavctn/img2table
import json import cv2 from img2table.tables import threshold_dark_areas from img2table.tables.objects.line import Line from img2table.tables.processing.borderless_tables import segment_image def test_segment_image(): img = cv2.cvtColor(cv2.imread("test_data/test.bmp"), cv2.COLOR_BGR2RGB) thresh = threshold_...
5
assert
numeric_literal
tests/tables/processing/borderless_tables/layout/test_layout.py
test_segment_image
27
null
xavctn/img2table
import cv2 import numpy as np from sewar import ssim from img2table.document.base.rotation import rotate_img_with_border, fix_rotation_image, get_connected_components, \ get_relevant_angles, angle_dixon_q_test def test_angle_dixon_q_test(): result = angle_dixon_q_test(angles=[12.23, 12.78, 12.79, 12.82], conf...
12.797
assert
numeric_literal
tests/document/base/test_rotation.py
test_angle_dixon_q_test
37
null
xavctn/img2table
import cv2 from img2table.tables.objects.cell import Cell from img2table.tables.processing.common import is_contained_cell, merge_contours, get_contours_cell def test_merge_contours(): contours = [Cell(x1=0, x2=20, y1=0, y2=20), Cell(x1=0, x2=20, y1=10, y2=20), Cell(x1=60, x2=80, y...
expected_vertical
assert
variable
tests/tables/processing/common/test_common.py
test_merge_contours
33
null
xavctn/img2table
import json import os import pickle import subprocess import sys from typing import NamedTuple, Dict import azure.cognitiveservices.vision.computervision import boto3 import pytest import requests from _pytest.python_api import ApproxBase, ApproxMapping, ApproxSequenceLike from google.cloud import vision from tests i...
expected)
pytest.approx
variable
tests/conftest.py
nested_approx
75
null
xavctn/img2table
import json from img2table.tables.objects.cell import Cell from img2table.tables.processing.borderless_tables.model import ImageSegment from img2table.tables.processing.borderless_tables.whitespaces import get_whitespaces, adjacent_whitespaces, \ identify_coherent_v_whitespaces, get_relevant_vertical_whitespaces ...
12
assert
numeric_literal
tests/tables/processing/borderless_tables/borderless_tables/test_whitespaces.py
test_get_relevant_vertical_whitespaces
69
null
xavctn/img2table
import os import cv2 import polars as pl import pytest from img2table.document.image import Image from img2table.ocr import TesseractOCR from img2table.ocr.data import OCRDataframe from tests import MOCK_DIR, TESSERACT_INSTALL def test_tesseract_content(mock_tesseract): instance = TesseractOCR() doc = Image(...
[f.read()]
assert
collection
tests/ocr/tesseract/test_tesseract.py
test_tesseract_content
53
null
xavctn/img2table
import json from img2table.tables.objects.cell import Cell from img2table.tables.processing.borderless_tables.model import ColumnGroup, VerticalWS, Column, Whitespace from img2table.tables.processing.borderless_tables.table.table_creation import get_table def test_get_table(): with open("test_data/delimiter_group...
8
assert
numeric_literal
tests/tables/processing/borderless_tables/table/test_table_creation.py
test_get_table
29
null
xavctn/img2table
from io import BytesIO import pytest from openpyxl import load_workbook from img2table.document.image import Image from img2table.ocr import TesseractOCR from img2table.tables.objects.extraction import BBox def test_blank_image(mock_tesseract): ocr = TesseractOCR() img = Image(src="test_data/blank.png", ...
[]
assert
collection
tests/document/image/test_image.py
test_blank_image
47
null
xavctn/img2table
import json import os import pickle import polars as pl import pytest from img2table.document import Image from img2table.ocr.data import OCRDataframe from img2table.ocr.google_vision import VisionEndpointContent, VisionAPIContent, VisionOCR from tests import MOCK_DIR def test_vision_ocr(mock_vision): image = Im...
ValueError)
pytest.raises
variable
tests/ocr/google_vision/test_google_vision.py
test_vision_ocr
65
null
xavctn/img2table
import json import polars as pl from img2table.ocr.data import OCRDataframe from img2table.tables.objects.cell import Cell from img2table.tables.objects.row import Row from img2table.tables.objects.table import Table def test_get_text_table(): ocr_df = OCRDataframe(df=pl.read_csv("test_data/ocr_df.csv", separato...
expected
assert
variable
tests/ocr/data/test_ocr_data.py
test_get_text_table
49
null
xavctn/img2table
import json from img2table.tables.objects.cell import Cell from img2table.tables.processing.borderless_tables import identify_table from img2table.tables.processing.borderless_tables.model import ColumnGroup, Column, VerticalWS, Whitespace def test_identify_table(): with open("test_data/delimiter_group.json", "r"...
8
assert
numeric_literal
tests/tables/processing/borderless_tables/table/test_table.py
test_identify_table
31
null
xavctn/img2table
import os import pickle import sys import polars as pl import pytest from img2table.document import Image from img2table.ocr import SuryaOCR from img2table.ocr.data import OCRDataframe from tests import MOCK_DIR @pytest.mark.skipif(sys.version_info < (3, 10), reason="Library not available") def test_content(mock_sur...
expected
assert
variable
tests/ocr/surya/test_surya.py
test_content
25
null
xavctn/img2table
import cv2 import numpy as np from sewar import ssim from img2table.document.base.rotation import rotate_img_with_border, fix_rotation_image, get_connected_components, \ get_relevant_angles, angle_dixon_q_test def test_get_relevant_angles(): centroids = [[35.8676, 5473.6768], [45.4648, 8734.3...
5
assert
numeric_literal
tests/document/base/test_rotation.py
test_get_relevant_angles
31
null
xavctn/img2table
import cv2 from img2table.tables.image import TableImage def test_table_image(): image = cv2.cvtColor(cv2.imread("test_data/test.png"), cv2.COLOR_BGR2RGB) tb_image = TableImage(img=image, min_confidence=50) result = tb_image.extract_tables(implicit_rows=True) result = sorte...
(962, 21, 1154, 123)
assert
collection
tests/tables/image/test_image.py
test_table_image
20
null
xavctn/img2table
import json from img2table.tables.objects.cell import Cell from img2table.tables.objects.row import Row from img2table.tables.objects.table import Table from img2table.tables.processing.bordered_tables.tables.implicit import implicit_content, implicit_rows_lines, \ implicit_columns_lines from img2table.tables.proc...
[395, 605, 725, 809, 886, 1212, 1285, 1396]
assert
collection
tests/tables/processing/bordered_tables/tables/test_implicit.py
test_implicit_columns_lines
52
null
xavctn/img2table
from img2table.tables.objects.line import Line def test_reprocess_line(): line = Line(x1=20, y1=73, x2=19, y2=20, thickness=18) reprocessed_line = line.reprocess() assert reprocessed_line ==
Line(x1=20, x2=20, y1=20, y2=73, thickness=18)
assert
func_call
tests/tables/objects/test_line.py
test_reprocess_line
21
null
xavctn/img2table
import json from img2table.tables.objects.cell import Cell from img2table.tables.processing.borderless_tables.model import ImageSegment from img2table.tables.processing.borderless_tables.whitespaces import get_whitespaces, adjacent_whitespaces, \ identify_coherent_v_whitespaces, get_relevant_vertical_whitespaces ...
38
assert
numeric_literal
tests/tables/processing/borderless_tables/borderless_tables/test_whitespaces.py
test_get_whitespaces
22
null
xavctn/img2table
import cv2 from img2table.tables import threshold_dark_areas from img2table.tables.metrics import compute_char_length, compute_median_line_sep, compute_img_metrics def test_compute_char_length(): image = cv2.cvtColor(cv2.imread("test_data/test.png"), cv2.COLOR_BGR2RGB) thresh = threshold_dark_areas(img=image,...
(417, 1365)
assert
collection
tests/tables/image/test_metrics.py
test_compute_char_length
14
null
xavctn/img2table
import json import os import polars as pl from img2table.document import Image from img2table.ocr import TextractOCR from img2table.ocr.data import OCRDataframe from tests import MOCK_DIR def test_content(mock_textract): img = Image("test_data/test.png") ocr = TextractOCR() result = ocr.content(document...
[expected]
assert
collection
tests/ocr/aws_textract/test_aws_textract.py
test_content
38
null
xavctn/img2table
from io import BytesIO import pytest from openpyxl import load_workbook from img2table.document.image import Image from img2table.ocr import TesseractOCR from img2table.tables.objects.extraction import BBox def test_no_ocr(): img = Image(src="test_data/dark.png", detect_rotation=True) result...
BBox(x1=46, y1=37, x2=836, y2=529)
assert
func_call
tests/document/image/test_image.py
test_no_ocr
90
null
xavctn/img2table
import json from io import BytesIO from xlsxwriter import Workbook from img2table.tables.objects.cell import Cell from img2table.tables.objects.extraction import create_all_rectangles, CellPosition, TableCell, BBox, CellSpan from img2table.tables.objects.row import Row from img2table.tables.objects.table import Table...
table.nb_columns
assert
complex_expr
tests/tables/objects/test_extraction.py
test_extracted_table_worksheet
51
null
xavctn/img2table
import json import sys from typing import Any import numpy as np import polars as pl import pytest from img2table.document.image import Image from img2table.ocr import EasyOCR from img2table.ocr.data import OCRDataframe def convert_np_types(obj: Any): if isinstance(obj, list): return [convert_np_types(el...
expected
assert
variable
tests/ocr/easyocr/test_easyocr.py
test_easyocr_ocr_df
61
null
xavctn/img2table
from img2table.tables.objects.line import Line def test_line(): line = Line(x1=0, y1=20, x2=46, y2=73) assert round(line.angle) ==
49
assert
numeric_literal
tests/tables/objects/test_line.py
test_line
9
null
xavctn/img2table
import cv2 from img2table.tables import threshold_dark_areas from img2table.tables.metrics import compute_char_length, compute_median_line_sep, compute_img_metrics def test_compute_char_length(): image = cv2.cvtColor(cv2.imread("test_data/test.png"), cv2.COLOR_BGR2RGB) thresh = threshold_dark_areas(img=image,...
9.0
assert
numeric_literal
tests/tables/image/test_metrics.py
test_compute_char_length
13
null
xavctn/img2table
import os import pickle import polars as pl import pytest from img2table.document import Image from img2table.ocr import AzureOCR from img2table.ocr.data import OCRDataframe from tests import MOCK_DIR def test_azure_ocr(mock_azure): # Test init error with pytest.raises(
TypeError)
pytest.raises
variable
tests/ocr/azure/test_azure.py
test_azure_ocr
40
null
xavctn/img2table
from img2table.tables.objects.line import Line def test_line(): line = Line(x1=0, y1=20, x2=46, y2=73) assert round(line.angle) == 49 assert line.width == 46 assert line.height ==
53
assert
numeric_literal
tests/tables/objects/test_line.py
test_line
11
null
xavctn/img2table
import sys from io import BytesIO import pytest from img2table.document.pdf import PDF from img2table.ocr import TesseractOCR from img2table.tables.objects.extraction import BBox def test_pdf_pages(): assert len(list(PDF(src="test_data/test.pdf").images)) == 2 assert len(list(PDF(src="test_data/test.pdf", p...
1
assert
numeric_literal
tests/document/pdf/test_pdf.py
test_pdf_pages
45
null
xavctn/img2table
import json from img2table.tables.objects.cell import Cell from img2table.tables.objects.row import Row from img2table.tables.objects.table import Table from img2table.tables.processing.bordered_tables.tables.implicit import implicit_content, implicit_rows_lines, \ implicit_columns_lines from img2table.tables.proc...
[682, 716, 784, 817, 884, 919, 986, 1020, 1089, 1121, 1189, 1223, 1292, 1325, 1394, 1427, 1494, 1529, 1597, 1630]
assert
collection
tests/tables/processing/bordered_tables/tables/test_implicit.py
test_implicit_rows_lines
29
null
xavctn/img2table
import json import cv2 from img2table.tables import threshold_dark_areas from img2table.tables.objects.cell import Cell from img2table.tables.objects.line import Line from img2table.tables.processing.borderless_tables import identify_borderless_tables def test_identify_borderless_tables(): img = cv2.cvtColor(cv2...
1
assert
numeric_literal
tests/tables/processing/borderless_tables/borderless_tables/test_borderless_tables.py
test_identify_borderless_tables
30
null
xavctn/img2table
from io import BytesIO import pytest from openpyxl import load_workbook from img2table.document.image import Image from img2table.ocr import TesseractOCR from img2table.tables.objects.extraction import BBox def test_image_tables(mock_tesseract): ocr = TesseractOCR() img = Image(src="test_data/test.png", ...
2
assert
numeric_literal
tests/document/image/test_image.py
test_image_tables
68
null
xavctn/img2table
from img2table.tables.objects.line import Line def test_line(): line = Line(x1=0, y1=20, x2=46, y2=73) assert round(line.angle) == 49 assert line.width ==
46
assert
numeric_literal
tests/tables/objects/test_line.py
test_line
10
null
xavctn/img2table
import pickle import sys import polars as pl import pytest from img2table.document.image import Image from img2table.ocr import DocTR from img2table.ocr.data import OCRDataframe def format_content(content): output = { id_page: {id_line: [{"value": word.value, "confidence": ro...
expected
assert
variable
tests/ocr/doctr/test_doctr.py
test_doctr_ocr_df
53
null
xavctn/img2table
import json import cv2 import polars as pl from img2table.ocr.data import OCRDataframe from img2table.tables.objects.cell import Cell from img2table.tables.objects.row import Row from img2table.tables.objects.table import Table from img2table.tables.processing.text.titles import get_title_tables def test_get_title_t...
[]
assert
collection
tests/tables/processing/text/test_titles.py
test_get_title_tables
23
null
xavctn/img2table
import cv2 import numpy as np from sewar import ssim from img2table.document.base.rotation import rotate_img_with_border, fix_rotation_image, get_connected_components, \ get_relevant_angles, angle_dixon_q_test def test_fix_rotation_image(): def crop_to_orig_img(img, orig_img): # Get original dimension...
0.85
assert
numeric_literal
tests/document/base/test_rotation.py
test_fix_rotation_image
65
null
xavctn/img2table
import json import os import pickle import polars as pl import pytest from img2table.document import Image from img2table.ocr.data import OCRDataframe from img2table.ocr.google_vision import VisionEndpointContent, VisionAPIContent, VisionOCR from tests import MOCK_DIR def test_vision_endpoint_content(mock_vision): ...
expected[0]
assert
complex_expr
tests/ocr/google_vision/test_google_vision.py
test_vision_endpoint_content
27
null
xavctn/img2table
import json import cv2 from img2table.tables import threshold_dark_areas from img2table.tables.objects.line import Line from img2table.tables.processing.borderless_tables import segment_image def test_segment_image(): img = cv2.cvtColor(cv2.imread("test_data/test.bmp"), cv2.COLOR_BGR2RGB) thresh = threshold_...
1
assert
numeric_literal
tests/tables/processing/borderless_tables/layout/test_layout.py
test_segment_image
31
null
xavctn/img2table
import json import polars as pl from img2table.ocr.data import OCRDataframe from img2table.tables.objects.cell import Cell from img2table.tables.objects.row import Row from img2table.tables.objects.table import Table def test_table(): with open("test_data/tables.json", "r") as f: tables = [Table(rows=[Ro...
3
assert
numeric_literal
tests/tables/objects/test_table.py
test_table
49
null
xavctn/img2table
from img2table.tables.objects.cell import Cell from img2table.tables.objects.row import Row def test_row(): row = Row(cells=[Cell(x1=0, x2=20, y1=0, y2=20), Cell(x1=20, x2=40, y1=0, y2=20)]) assert row.x1 ==
0
assert
numeric_literal
tests/tables/objects/test_row.py
test_row
9
null
xavctn/img2table
from io import BytesIO import pytest from openpyxl import load_workbook from img2table.document.image import Image from img2table.ocr import TesseractOCR from img2table.tables.objects.extraction import BBox def test_load_image(): # Load from path img_from_path = Image(src="test_data/test.png") # Load fr...
img_from_bytes.bytes
assert
complex_expr
tests/document/image/test_image.py
test_load_image
32
null
xavctn/img2table
import json import cv2 import polars as pl from img2table.ocr.data import OCRDataframe from img2table.tables.objects.cell import Cell from img2table.tables.objects.row import Row from img2table.tables.objects.table import Table from img2table.tables.processing.text.titles import get_title_tables def test_get_title_t...
"10 most populous countries"
assert
string_literal
tests/tables/processing/text/test_titles.py
test_get_title_tables
22
null
auth0/auth0-python
import base64 import json import sys import unittest from unittest import mock import requests from auth0.authentication.base import AuthenticationBase from auth0.authentication.exceptions import Auth0Error, RateLimitError class TestBase(unittest.TestCase): @mock.patch("requests.request") def test_post_rate...
9)
self.assertEqual
numeric_literal
tests/authentication/test_base.py
test_post_rate_limit_error
TestBase
160
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.database import Database class TestDatabase(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post") def test_signup(self, mock_post): d = Database("my.domain.com", "cid") # using only email and password ...
"https://my.domain.com/dbconnections/signup")
self.assertEqual
string_literal
tests/authentication/test_database.py
test_signup
TestDatabase
17
null
auth0/auth0-python
import unittest from unittest import mock import json import requests from auth0.authentication.exceptions import Auth0Error, RateLimitError from auth0.authentication.back_channel_login import BackChannelLogin class TestBackChannelLogin(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post")...
"https://my.domain.com/bc-authorize")
self.assertEqual
string_literal
tests/authentication/test_back_channel_login.py
test_ciba
TestBackChannelLogin
24
null
auth0/auth0-python
import unittest from unittest import mock import json import requests from auth0.authentication.exceptions import Auth0Error, RateLimitError from auth0.authentication.back_channel_login import BackChannelLogin class TestBackChannelLogin(unittest.TestCase): def test_requested_expiry_negative_raises(self): ...
ValueError)
self.assertRaises
variable
tests/authentication/test_back_channel_login.py
test_requested_expiry_negative_raises
TestBackChannelLogin
184
null
auth0/auth0-python
import json import time import unittest from unittest.mock import MagicMock, patch import jwt from auth0.authentication.token_verifier import ( AsymmetricSignatureVerifier, JwksFetcher, SignatureVerifier, SymmetricSignatureVerifier, TokenVerifier, ) from auth0.authentication.exceptions import Toke...
3600)
self.assertEqual
numeric_literal
tests/authentication/test_token_verifier.py
test_asymmetric_verifier_uses_provided_jwks_cache_ttl
TestSignatureVerifier
78
null
auth0/auth0-python
from auth0.management.core.query_encoder import encode_query def test_query_encoding_deep_objects() -> None: assert encode_query({"hello world": "hello world"}) ==
[("hello world", "hello world")]
assert
collection
tests/utils/test_query_encoding.py
test_query_encoding_deep_objects
7
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.social import Social class TestSocial(unittest.TestCase): @mock.patch("auth0.authentication.social.Social.post") def test_login(self, mock_post): s = Social("a.b.c", "cid") s.login(access_token="atk", connection="conn") ...
{ "client_id": "cid", "access_token": "atk", "connection": "conn", "scope": "openid", })
self.assertEqual
collection
tests/authentication/test_social.py
test_login
TestSocial
16
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.delegated import Delegated class TestDelegated(unittest.TestCase): @mock.patch("auth0.authentication.delegated.Delegated.post") def test_get_token_id_token(self, mock_post): d = Delegated("my.domain.com", "cid") d.get_token( ...
"https://my.domain.com/delegation")
self.assertEqual
string_literal
tests/authentication/test_delegated.py
test_get_token_id_token
TestDelegated
22
null
auth0/auth0-python
import time from unittest.mock import MagicMock, patch import pytest from auth0.management import AsyncManagementClient, AsyncTokenProvider, ManagementClient, TokenProvider class TestTokenProvider: @patch("auth0.management.token_provider.httpx.Client") def test_get_token_returns_cached_token(self, mock_clie...
1
assert
numeric_literal
tests/management/test_management_client.py
test_get_token_returns_cached_token
TestTokenProvider
250
null
auth0/auth0-python
import base64 import json import sys import unittest from unittest import mock import requests from auth0.authentication.base import AuthenticationBase from auth0.authentication.exceptions import Auth0Error, RateLimitError class TestBase(unittest.TestCase): @mock.patch("requests.request") def test_post_rate...
"9")
self.assertEqual
string_literal
tests/authentication/test_base.py
test_post_rate_limit_error
TestBase
164
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.passwordless import Passwordless class TestPasswordless(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post") def test_send_sms(self, mock_post): p = Passwordless("my.domain.com", "cid") p.sms(phone_nu...
{ "client_id": "cid", "phone_number": "123456", "connection": "sms", })
self.assertEqual
collection
tests/authentication/test_passwordless.py
test_send_sms
TestPasswordless
76
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.passwordless import Passwordless class TestPasswordless(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post") def test_send_email_with_auth_params(self, mock_post): p = Passwordless("my.domain.com", "cid") ...
{ "client_id": "cid", "email": "a@b.com", "send": "snd", "authParams": {"a": "b"}, "connection": "email", })
self.assertEqual
collection
tests/authentication/test_passwordless.py
test_send_email_with_auth_params
TestPasswordless
36
null
auth0/auth0-python
import json import time import unittest from unittest.mock import MagicMock, patch import jwt from auth0.authentication.token_verifier import ( AsymmetricSignatureVerifier, JwksFetcher, SignatureVerifier, SymmetricSignatureVerifier, TokenVerifier, ) from auth0.authentication.exceptions import Toke...
"HS256")
self.assertEqual
string_literal
tests/authentication/test_token_verifier.py
test_symmetric_verifier_uses_hs256_alg
TestSignatureVerifier
66
null
auth0/auth0-python
import base64 import json import sys import unittest from unittest import mock import requests from auth0.authentication.base import AuthenticationBase from auth0.authentication.exceptions import Auth0Error, RateLimitError class TestBase(unittest.TestCase): @mock.patch("requests.request") def test_post_rate...
-1)
self.assertEqual
numeric_literal
tests/authentication/test_base.py
test_post_rate_limit_error_without_headers
TestBase
183
null
auth0/auth0-python
import base64 import json import sys import unittest from unittest import mock import requests from auth0.authentication.base import AuthenticationBase from auth0.authentication.exceptions import Auth0Error, RateLimitError class TestBase(unittest.TestCase): @mock.patch("requests.request") def test_post_incl...
"POST")
self.assertEqual
string_literal
tests/authentication/test_base.py
test_post_includes_telemetry
TestBase
94
null
auth0/auth0-python
import time from unittest.mock import MagicMock, patch import pytest from auth0.management import AsyncManagementClient, AsyncTokenProvider, ManagementClient, TokenProvider class TestTokenProvider: @patch("auth0.management.token_provider.httpx.Client") def test_get_token_returns_cached_token(self, mock_clie...
token2
assert
variable
tests/management/test_management_client.py
test_get_token_returns_cached_token
TestTokenProvider
248
null
auth0/auth0-python
from typing import Any, List from .assets.models import ObjectWithOptionalFieldParams, ShapeParams from auth0.management.core.serialization import convert_and_respect_annotation_metadata UNION_TEST: ShapeParams = {"radius_measurement": 1.0, "shape_type": "circle", "id": "1"} UNION_TEST_CONVERTED = {"shapeType": "cir...
data
assert
variable
tests/utils/test_serialization.py
test_convert_and_respect_annotation_metadata_with_empty_object
72
null
auth0/auth0-python
import unittest import json from unittest import mock from auth0.authentication.pushed_authorization_requests import PushedAuthorizationRequests class TestRevokeToken(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post") def test_par(self, mock_post): a = PushedAuthorizationRequ...
{ "client_id": "cid", "client_secret": "sh!", "response_type": "code", "redirect_uri": "https://example.com/callback", })
self.assertEqual
collection
tests/authentication/test_pushed_authorization_requests.py
test_par
TestRevokeToken
19
null
auth0/auth0-python
from auth0.management.core.query_encoder import encode_query def test_query_encoding_deep_object_arrays() -> None: assert encode_query({"objects": [{"key": "hello", "value": "world"}, {"key": "foo", "value": "bar"}]}) ==
[ ("objects[key]", "hello"), ("objects[value]", "world"), ("objects[key]", "foo"), ("objects[value]", "bar"), ]
assert
collection
tests/utils/test_query_encoding.py
test_query_encoding_deep_object_arrays
17
null
auth0/auth0-python
from auth0.management.core.query_encoder import encode_query def test_query_encoding_deep_object_arrays() -> None: assert encode_query({"objects": [{"key": "hello", "value": "world"}, {"key": "foo", "value": "bar"}]}) == [ ("objects[key]", "hello"), ("objects[value]", "world"), ("objects[ke...
[ ("users[name]", "string"), ("users[tags]", "string"), ("users[name]", "string2"), ("users[tags]", "string2"), ("users[tags]", "string3"), ]
assert
collection
tests/utils/test_query_encoding.py
test_query_encoding_deep_object_arrays
23
null
auth0/auth0-python
import base64 import json import sys import unittest from unittest import mock import requests from auth0.authentication.base import AuthenticationBase from auth0.authentication.exceptions import Auth0Error, RateLimitError class TestBase(unittest.TestCase): @mock.patch("requests.request") def test_post_rate...
"6")
self.assertEqual
string_literal
tests/authentication/test_base.py
test_post_rate_limit_error
TestBase
163
null
auth0/auth0-python
import base64 import json import sys import unittest from unittest import mock import requests from auth0.authentication.base import AuthenticationBase from auth0.authentication.exceptions import Auth0Error, RateLimitError class TestBase(unittest.TestCase): @mock.patch("requests.request") def test_get_inclu...
"GET")
self.assertEqual
string_literal
tests/authentication/test_base.py
test_get_includes_telemetry
TestBase
300
null
auth0/auth0-python
from typing import Any, Dict import pytest from auth0.management.core.http_client import ( AsyncHttpClient, HttpClient, _build_url, get_request_body, remove_none_from_dict, ) from auth0.management.core.request_options import RequestOptions def get_request_options() -> RequestOptions: return {...
None
assert
none_literal
tests/utils/test_http_client.py
test_get_json_request_body
58
null
auth0/auth0-python
import unittest from unittest import mock import json import requests from auth0.authentication.exceptions import Auth0Error, RateLimitError from auth0.authentication.back_channel_login import BackChannelLogin class TestBackChannelLogin(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post"...
{ "client_id": "cid", "client_secret": "clsec", "binding_message": "This is a binding message", "login_hint": "{ \"format\": \"iss_sub\", \"iss\": \"https://my.domain.auth0.com/\", \"sub\": \"auth0|[USER ID]\" }", "scope": "openid", "requested_expiry": "100", })
self.assertEqual
collection
tests/authentication/test_back_channel_login.py
test_with_request_expiry
TestBackChannelLogin
170
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.social import Social class TestSocial(unittest.TestCase): @mock.patch("auth0.authentication.social.Social.post") def test_login_with_scope(self, mock_post): s = Social("a.b.c", "cid") s.login( access_token="atk", ...
{ "client_id": "cid", "access_token": "atk", "connection": "conn", "scope": "openid profile", })
self.assertEqual
collection
tests/authentication/test_social.py
test_login_with_scope
TestSocial
38
null
auth0/auth0-python
import unittest import json from unittest import mock from auth0.authentication.pushed_authorization_requests import PushedAuthorizationRequests class TestRevokeToken(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post") def test_par(self, mock_post): a = PushedAuthorizationRequ...
"https://my.domain.com/oauth/par")
self.assertEqual
string_literal
tests/authentication/test_pushed_authorization_requests.py
test_par
TestRevokeToken
18
null
auth0/auth0-python
import json import time import unittest from unittest.mock import MagicMock, patch import jwt from auth0.authentication.token_verifier import ( AsymmetricSignatureVerifier, JwksFetcher, SignatureVerifier, SymmetricSignatureVerifier, TokenVerifier, ) from auth0.authentication.exceptions import Toke...
1)
self.assertEqual
numeric_literal
tests/authentication/test_token_verifier.py
test_get_jwks_json_twice_on_cache_expired
TestJwksFetcher
152
null
auth0/auth0-python
import time from unittest.mock import MagicMock, patch import pytest from auth0.management import AsyncManagementClient, AsyncTokenProvider, ManagementClient, TokenProvider class TestTokenProvider: @patch("auth0.management.token_provider.httpx.Client") def test_get_token_fetches_on_first_call(self, mock_cli...
"new-token"
assert
string_literal
tests/management/test_management_client.py
test_get_token_fetches_on_first_call
TestTokenProvider
220
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.passwordless import Passwordless class TestPasswordless(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post") def test_send_sms_with_client_secret(self, mock_post): p = Passwordless("my.domain.com", "cid", clie...
{ "client_id": "cid", "client_secret": "csecret", "phone_number": "123456", "connection": "sms", })
self.assertEqual
collection
tests/authentication/test_passwordless.py
test_send_sms_with_client_secret
TestPasswordless
94
null
auth0/auth0-python
from typing import Any, List from .assets.models import ObjectWithOptionalFieldParams, ShapeParams from auth0.management.core.serialization import convert_and_respect_annotation_metadata UNION_TEST: ShapeParams = {"radius_measurement": 1.0, "shape_type": "circle", "id": "1"} UNION_TEST_CONVERTED = {"shapeType": "cir...
{"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"}
assert
collection
tests/utils/test_serialization.py
test_convert_and_respect_annotation_metadata
24
null
auth0/auth0-python
import unittest from unittest import mock import json import requests from auth0.authentication.exceptions import Auth0Error, RateLimitError from auth0.authentication.back_channel_login import BackChannelLogin class TestBackChannelLogin(unittest.TestCase): @mock.patch("requests.request") def test_server_err...
Auth0Error)
self.assertRaises
variable
tests/authentication/test_back_channel_login.py
test_server_error
TestBackChannelLogin
44
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.database import Database class TestDatabase(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post") def test_change_password(self, mock_post): d = Database("my.domain.com", "cid") # ignores the password ...
"https://my.domain.com/dbconnections/change_password")
self.assertEqual
string_literal
tests/authentication/test_database.py
test_change_password
TestDatabase
72
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.revoke_token import RevokeToken class TestRevokeToken(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post") def test_revoke_refresh_token(self, mock_post): a = RevokeToken("my.domain.com", "cid") # regu...
"https://my.domain.com/oauth/revoke")
self.assertEqual
string_literal
tests/authentication/test_revoke_token.py
test_revoke_refresh_token
TestRevokeToken
17
null
auth0/auth0-python
import unittest from unittest import mock import json import requests from auth0.authentication.exceptions import Auth0Error, RateLimitError from auth0.authentication.back_channel_login import BackChannelLogin class TestBackChannelLogin(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post"...
str(context.exception))
self.assertIn
func_call
tests/authentication/test_back_channel_login.py
test_should_require_binding_message
TestBackChannelLogin
65
null
auth0/auth0-python
import json import time import unittest from unittest.mock import MagicMock, patch import jwt from auth0.authentication.token_verifier import ( AsymmetricSignatureVerifier, JwksFetcher, SignatureVerifier, SymmetricSignatureVerifier, TokenVerifier, ) from auth0.authentication.exceptions import Toke...
response)
self.assertIn
variable
tests/authentication/test_token_verifier.py
test_succeeds_when_org_name_specified_matches
TestTokenVerifier
547
null
auth0/auth0-python
from typing import Any, List from .assets.models import ObjectWithOptionalFieldParams, ShapeParams from auth0.management.core.serialization import convert_and_respect_annotation_metadata UNION_TEST: ShapeParams = {"radius_measurement": 1.0, "shape_type": "circle", "id": "1"} UNION_TEST_CONVERTED = {"shapeType": "cir...
[ {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"}, {"string": "another string", "long": 67890, "list": [], "literal": "lit_one", "any": "any"}, ]
assert
collection
tests/utils/test_serialization.py
test_convert_and_respect_annotation_metadata_in_list
36
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.database import Database class TestDatabase(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post") def test_signup(self, mock_post): d = Database("my.domain.com", "cid") # using only email and password ...
{ "client_id": "cid", "email": "a@b.com", "password": "pswd", "connection": "conn", "username": "usr", "user_metadata": sample_meta, "given_name": "john", "family_name": "doe", "name": "john doe", "nickname": "johnny", "picture": "avatars.com/john-doe", })
self.assertEqual
collection
tests/authentication/test_database.py
test_signup
TestDatabase
46
null
auth0/auth0-python
import time from unittest.mock import MagicMock, patch import pytest from auth0.management import AsyncManagementClient, AsyncTokenProvider, ManagementClient, TokenProvider class TestManagementClientInit: def test_init_requires_auth(self): """Should raise ValueError when no auth is provided.""" ...
ValueError)
pytest.raises
variable
tests/management/test_management_client.py
test_init_requires_auth
TestManagementClientInit
50
null
auth0/auth0-python
import unittest from unittest import mock import json import requests from auth0.authentication.exceptions import Auth0Error, RateLimitError from auth0.authentication.back_channel_login import BackChannelLogin class TestBackChannelLogin(unittest.TestCase): @mock.patch("requests.request") def test_server_err...
400)
self.assertEqual
numeric_literal
tests/authentication/test_back_channel_login.py
test_server_error
TestBackChannelLogin
50
null
auth0/auth0-python
import unittest from unittest import mock from auth0.authentication.database import Database class TestDatabase(unittest.TestCase): @mock.patch("auth0.authentication.rest.RestClient.post") def test_change_password_with_organization_param(self, mock_post): d = Database("my.domain.com", "cid") ...
{ "client_id": "cid", "email": "a@b.com", "connection": "conn", "organization": "org_id", })
self.assertEqual
collection
tests/authentication/test_database.py
test_change_password_with_organization_param
TestDatabase
94
null