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 |
|---|---|---|---|---|---|---|---|---|---|
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.pie_chart import PieChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
class TestPie... | 0 | assert | numeric_literal | tests/diagram_tests/pie_chart_test.py | test_group_contains_objects | TestPieChartGroupIntegration | 371 | null |
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.pie_chart import PieChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
class TestPie... | 24 | assert | numeric_literal | tests/diagram_tests/pie_chart_test.py | test_custom_text_formats | TestPieChartTextFormatting | 293 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram_types.binary_tree import BinaryNodeObject, BinaryTreeDiagram
class TestBinaryTreeDiagramHelpers:
def test_add_left_and_add_right_assign_tree(self):
"""Helpers should attach nodes to the diagram and set parent links."""
bt = BinaryTreeDiagram()
... | r | assert | variable | tests/diagram_tests/binary_tree_diagram_test.py | test_add_left_and_add_right_assign_tree | TestBinaryTreeDiagramHelpers | 100 | null |
MerrimanInd/drawpyo | import drawpyo
from pathlib import Path
import xml.etree.ElementTree as ET
import pytest
class TestFileAddPage:
def test_add_multiple_pages(self, empty_file: drawpyo.File) -> None:
"""Checks for adding multiple pages"""
page_1 = drawpyo.Page(file=empty_file, name="Page-1")
page_2 = drawpyo... | page_2 | assert | variable | tests/file_test.py | test_add_multiple_pages | TestFileAddPage | 68 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import ColorScheme, StandardColor
def test_hex_strings_normalize_to_uppercase():
scheme = ColorScheme(fill_color="#a1b2c3")
assert scheme.fill_color == | "#A1B2C3" | assert | string_literal | tests/diagram_tests/color_management_test.py | test_hex_strings_normalize_to_uppercase | 76 | null | |
MerrimanInd/drawpyo | import pytest
from drawpyo.diagram_types.legend import Legend
from drawpyo.diagram.text_format import TextFormat
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.page import Page
from drawpyo.diagram.objects import Object, Group
def simple_mapping... | None | assert | none_literal | tests/diagram_tests/legend_test.py | test_background_is_added | TestLegendBackground | 124 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import load_diagram
from drawpyo.diagram import Object, Edge
SAMPLE_XML = """<mxfile host="Drawpyo">
<diagram name="Page-1">
<mxGraphModel dx="2037" dy="830" grid="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="100" value="List" style="swimlane" p... | None | assert | none_literal | tests/import_tests/test_import_drawio.py | test_diagram_loads | TestDrawpyoParsing | 37 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram.base_diagram import (
color_input_check,
width_input_check,
style_str_from_dict,
import_shape_database,
)
class TestGeometry:
def test_geometry_init_default(self) -> None:
"""Checks the default initialization of Geometry"""
geom = d... | 60 | assert | numeric_literal | tests/diagram_tests/base_diagram_test.py | test_geometry_init_default | TestGeometry | 214 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import load_diagram
from drawpyo.diagram import Object, Edge
SAMPLE_XML = """<mxfile host="Drawpyo">
<diagram name="Page-1">
<mxGraphModel dx="2037" dy="830" grid="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="100" value="List" style="swimlane" p... | 0 | assert | numeric_literal | tests/import_tests/test_import_drawio.py | test_no_edges | TestDrawpyoParsing | 83 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.utils.standard_colors import StandardColor
def parse_style(style: str) -> dict[str, str]:
"""Convert a style string into a dict for order-independent comparison."""
if not style:
return {}
parts = style.sp... | "#FF0000" | assert | string_literal | tests/diagram_tests/object_test.py | test_template_chain | TestObjectTemplate | 140 | null |
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.pie_chart import PieChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
class TestPie... | 2 | assert | numeric_literal | tests/diagram_tests/pie_chart_test.py | test_multiple_updates | TestPieChartEdgeCases | 451 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram.edges import Edge, EdgeGeometry, EdgeLabel, Point
from drawpyo.utils.color_scheme import ColorScheme
class TestEdgeGeometry:
def test_entry_exit_offsets(self, empty_page: drawpyo.Page) -> None:
"""Checks the offsets of entry and exit points"""
edge... | 25 | assert | numeric_literal | tests/diagram_tests/edge_test.py | test_entry_exit_offsets | TestEdgeGeometry | 159 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram.base_diagram import (
color_input_check,
width_input_check,
style_str_from_dict,
import_shape_database,
)
class TestWidthInputCheck:
def test_valid_width(self) -> None:
"""Checks for valid width values"""
assert width_input_check(1... | 1 | assert | numeric_literal | tests/diagram_tests/base_diagram_test.py | test_valid_width | TestWidthInputCheck | 80 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo.diagram_types.legend import Legend
from drawpyo.diagram.text_format import TextFormat
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.page import Page
from drawpyo.diagram.objects import Object, Group
def simple_mapping... | "#ff0000" | assert | string_literal | tests/diagram_tests/legend_test.py | test_standard_color_box | TestLegendColors | 140 | null |
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.bar_chart import BarChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
class TestBarChartAxisAndTicks:
def test_axis_enabled(self):
"""Test enabling axis."""
chart = BarC... | True | assert | bool_literal | tests/diagram_tests/bar_chart_test.py | test_axis_enabled | TestBarChartAxisAndTicks | 229 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import ColorScheme, StandardColor
def test_hierarchy_defaults_used_when_both_missing():
obj = DummyObject()
assert obj.resolved_fill() == DummyObject.DEFAULT_FILL
assert obj.resolved_stroke() == | DummyObject.DEFAULT_STROKE | assert | complex_expr | tests/diagram_tests/color_management_test.py | test_hierarchy_defaults_used_when_both_missing | 206 | null | |
MerrimanInd/drawpyo | import pytest
import drawpyo
class TestTranslateTxt:
def test_translate_txt_empty_string(self) -> None:
"""Tests for handling empty strings"""
result = drawpyo.XMLBase.translate_txt("", {"a": "b"})
assert result == | "" | assert | string_literal | tests/xml_base_test.py | test_translate_txt_empty_string | TestTranslateTxt | 138 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram.base_diagram import (
color_input_check,
width_input_check,
style_str_from_dict,
import_shape_database,
)
class TestWidthInputCheck:
def test_valid_width(self) -> None:
"""Checks for valid width values"""
assert width_input_check(1)... | 999 | assert | numeric_literal | tests/diagram_tests/base_diagram_test.py | test_valid_width | TestWidthInputCheck | 82 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import load_diagram
from drawpyo.diagram import Object, Edge
SAMPLE_XML = """<mxfile host="Drawpyo">
<diagram name="Page-1">
<mxGraphModel dx="2037" dy="830" grid="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="100" value="List" style="swimlane" p... | 60 | assert | numeric_literal | tests/import_tests/test_import_drawio.py | test_geometry_parsing | TestDrawpyoParsing | 70 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
class TestXMLBaseInit:
def test_default_values(self, xml_base: drawpyo.XMLBase) -> None:
"""Checks default values when creating XMLBase"""
assert xml_base.id == id(xml_base)
assert xml_base.xml_class == | "xml_tag" | assert | string_literal | tests/xml_base_test.py | test_default_values | TestXMLBaseInit | 18 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
class TestTranslateTxt:
def test_translate_txt_multiple_occurrences(self) -> None:
"""Checks for multiple occurrences of a replacement"""
result = drawpyo.XMLBase.translate_txt("aaa", {"a": "b"})
assert result == | "bbb" | assert | string_literal | tests/xml_base_test.py | test_translate_txt_multiple_occurrences | TestTranslateTxt | 133 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo.diagram_types.legend import Legend
from drawpyo.diagram.text_format import TextFormat
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.page import Page
from drawpyo.diagram.objects import Object, Group
def simple_mapping... | 16 | assert | numeric_literal | tests/diagram_tests/legend_test.py | test_title_object_created | TestLegendTitle | 102 | null |
MerrimanInd/drawpyo | import drawpyo
import pytest
class TestPageInit:
def test_grid_settings(self, empty_page: drawpyo.Page) -> None:
"""Checks the default grid settings"""
assert empty_page.grid == | 1 | assert | numeric_literal | tests/page_test.py | test_grid_settings | TestPageInit | 27 | null |
MerrimanInd/drawpyo | from unittest.mock import patch, mock_open
import pytest
import os
from pathlib import Path
from drawpyo.drawio_import.mxlibrary_parser import parse_mxlibrary, load_mxlibrary
import drawpyo
FIXTURES_DIR = Path(__file__).parent / "fixtures"
SAMPLE_LIBRARY_PATH = FIXTURES_DIR / "sample_library.xml"
OUTPUT_DIR = Path(__... | 0 | assert | numeric_literal | tests/import_tests/test_mxlibrary_import.py | test_parse_mxlibrary_parsed_correctly | TestParseMxlibrary | 35 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram.edges import Edge, EdgeGeometry, EdgeLabel, Point
from drawpyo.utils.color_scheme import ColorScheme
class TestEdgeGeometry:
def test_entry_exit_offsets(self, empty_page: drawpyo.Page) -> None:
"""Checks the offsets of entry and exit points"""
edge... | 20 | assert | numeric_literal | tests/diagram_tests/edge_test.py | test_entry_exit_offsets | TestEdgeGeometry | 157 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.utils.standard_colors import StandardColor
def parse_style(style: str) -> dict[str, str]:
"""Convert a style string into a dict for order-independent comparison."""
if not style:
return {}
parts = style.sp... | (0, 0) | assert | collection | tests/diagram_tests/object_test.py | test_default_values | TestObjectInit | 37 | null |
MerrimanInd/drawpyo | import drawpyo
import pytest
class TestPageObjects:
def test_add_multiple_objects(self, empty_page: drawpyo.Page) -> None:
"""Checks if multiple objects have been added"""
obj1 = drawpyo.diagram.Object(page=empty_page, value="Object 1")
obj2 = drawpyo.diagram.Object(page=empty_page, value=... | 5 | assert | numeric_literal | tests/page_test.py | test_add_multiple_objects | TestPageObjects | 149 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.utils.standard_colors import StandardColor
def parse_style(style: str) -> dict[str, str]:
"""Convert a style string into a dict for order-independent comparison."""
if not style:
return {}
parts = style.sp... | "#FF6B6B" | assert | string_literal | tests/diagram_tests/object_test.py | test_fill_color | TestObjectColors | 150 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram_types.binary_tree import BinaryNodeObject, BinaryTreeDiagram
class TestBinaryTreeDiagramFromDict:
def test_from_dict_nested_structure(self):
"""Test a more complex nested dictionary structure."""
data = {
"A": {"B": ["D", None], "C": ... | e | assert | variable | tests/diagram_tests/binary_tree_diagram_test.py | test_from_dict_nested_structure | TestBinaryTreeDiagramFromDict | 262 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
class TestXMLBaseTags:
def test_open_tag_with_multiple_attributes(self) -> None:
"""Checks the generation of a tag with multiple attributes"""
obj = drawpyo.XMLBase(id="test_id", xml_class="mxCell", xml_parent="parent_id")
assert 'id="test_id"' in | obj.xml_open_tag | assert | complex_expr | tests/xml_base_test.py | test_open_tag_with_multiple_attributes | TestXMLBaseTags | 83 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.utils.standard_colors import StandardColor
def parse_style(style: str) -> dict[str, str]:
"""Convert a style string into a dict for order-independent comparison."""
if not style:
return {}
parts = style.sp... | 200 | assert | numeric_literal | tests/diagram_tests/object_test.py | test_width_update | TestObjectGeometry | 194 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import load_diagram
from drawpyo.diagram import Object, Edge
SAMPLE_XML = """<mxfile host="Drawpyo">
<diagram name="Page-1">
<mxGraphModel dx="2037" dy="830" grid="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="100" value="List" style="swimlane" p... | list_obj.children | assert | complex_expr | tests/import_tests/test_import_drawio.py | test_get_by_id | TestDrawpyoParsing | 54 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
class TestTranslateTxt:
def test_translate_txt_no_replacements(self) -> None:
"""Checks operation without replacements"""
result = drawpyo.XMLBase.translate_txt("hello", {})
assert result == | "hello" | assert | string_literal | tests/xml_base_test.py | test_translate_txt_no_replacements | TestTranslateTxt | 128 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.utils.standard_colors import StandardColor
def parse_style(style: str) -> dict[str, str]:
"""Convert a style string into a dict for order-independent comparison."""
if not style:
return {}
parts = style.sp... | parent | assert | variable | tests/diagram_tests/object_test.py | test_parent_child_relationship | TestObjectHierarchy | 247 | null |
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.bar_chart import BarChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
class TestBarChartEdgeCases:
def test_multiple_updates(self):
"""Test multiple sequential updates."""
... | 2 | assert | numeric_literal | tests/diagram_tests/bar_chart_test.py | test_multiple_updates | TestBarChartEdgeCases | 435 | null |
MerrimanInd/drawpyo | import drawpyo
from pathlib import Path
import xml.etree.ElementTree as ET
import pytest
class TestFileAddPage:
def test_add_page_basic(self, empty_file: drawpyo.File) -> None:
"""Checks basic page addition"""
page = drawpyo.Page()
empty_file.add_page(page)
assert page.file == emp... | page | assert | variable | tests/file_test.py | test_add_page_basic | TestFileAddPage | 50 | null |
MerrimanInd/drawpyo | from unittest.mock import patch, mock_open
import pytest
import os
from pathlib import Path
from drawpyo.drawio_import.mxlibrary_parser import parse_mxlibrary, load_mxlibrary
import drawpyo
FIXTURES_DIR = Path(__file__).parent / "fixtures"
SAMPLE_LIBRARY_PATH = FIXTURES_DIR / "sample_library.xml"
OUTPUT_DIR = Path(__... | 4 | assert | numeric_literal | tests/import_tests/test_mxlibrary_import.py | test_load_mxlibrary_from_local_file | TestLoadMxlibrary | 63 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram.edges import Edge, EdgeGeometry, EdgeLabel, Point
from drawpyo.utils.color_scheme import ColorScheme
class TestEdgeGeometry:
def test_entry_exit_points(self, empty_page: drawpyo.Page) -> None:
"""Checks entry and exit points"""
edge = Edge(
... | 0.5 | assert | numeric_literal | tests/diagram_tests/edge_test.py | test_entry_exit_points | TestEdgeGeometry | 142 | null |
MerrimanInd/drawpyo | import drawpyo
from pathlib import Path
import xml.etree.ElementTree as ET
import pytest
class TestFileInit:
def test_default_values(self, empty_file: drawpyo.File) -> None:
"""Checks default values when creating an empty file"""
user_path = Path.home() / "Drawpyo Charts"
assert empty_file... | 0 | assert | numeric_literal | tests/file_test.py | test_default_values | TestFileInit | 20 | null |
MerrimanInd/drawpyo | import drawpyo
import pytest
class TestPageInit:
def test_viewport_settings(self, empty_page: drawpyo.Page) -> None:
"""Checks the default viewport settings"""
assert empty_page.dx == 2037
assert empty_page.dy == | 830 | assert | numeric_literal | tests/page_test.py | test_viewport_settings | TestPageInit | 23 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram.base_diagram import (
color_input_check,
width_input_check,
style_str_from_dict,
import_shape_database,
)
class TestGeometry:
def test_geometry_init_default(self) -> None:
"""Checks the default initialization of Geometry"""
geom = d... | 120 | assert | numeric_literal | tests/diagram_tests/base_diagram_test.py | test_geometry_init_default | TestGeometry | 213 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
class TestXMLBaseInit:
def test_default_values(self, xml_base: drawpyo.XMLBase) -> None:
"""Checks default values when creating XMLBase"""
assert xml_base.id == | id(xml_base) | assert | func_call | tests/xml_base_test.py | test_default_values | TestXMLBaseInit | 17 | null |
MerrimanInd/drawpyo | import drawpyo
import pytest
class TestPageInit:
def test_special_features(self, empty_page: drawpyo.Page) -> None:
"""Checks special default functions"""
assert empty_page.math == | 0 | assert | numeric_literal | tests/page_test.py | test_special_features | TestPageInit | 57 | null |
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.bar_chart import BarChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
class TestBarChartScaleCalculation:
def test_calculate_scale_equal_values(self):
"""Test scale with all equ... | 4.0 | assert | numeric_literal | tests/diagram_tests/bar_chart_test.py | test_calculate_scale_equal_values | TestBarChartScaleCalculation | 300 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.utils.standard_colors import StandardColor
def parse_style(style: str) -> dict[str, str]:
"""Convert a style string into a dict for order-independent comparison."""
if not style:
return {}
parts = style.sp... | "solid" | assert | string_literal | tests/diagram_tests/object_test.py | test_stroke_width | TestObjectStrokeStyles | 208 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram.edges import Edge, EdgeGeometry, EdgeLabel, Point
from drawpyo.utils.color_scheme import ColorScheme
class TestEdgeInit:
def test_default_values(self, empty_page: drawpyo.Page) -> None:
"""Checks default values when creating Edge"""
edge = Edge(pag... | 1 | assert | numeric_literal | tests/diagram_tests/edge_test.py | test_default_values | TestEdgeInit | 24 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
class TestXMLBaseInit:
def test_custom_xml_parent(self) -> None:
"""Checks the setting of the parent XML element"""
parent_obj = drawpyo.XMLBase(id="parent")
child_obj = drawpyo.XMLBase(xml_parent=parent_obj.id)
assert child_obj.xml_parent == | parent_obj.id | assert | complex_expr | tests/xml_base_test.py | test_custom_xml_parent | TestXMLBaseInit | 36 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram_types.binary_tree import BinaryNodeObject, BinaryTreeDiagram
class TestBinaryTreeDiagramHelpers:
def test_replace_right_then_left_positions(self):
"""Moving an existing child from right to left reorders tree_children."""
parent = BinaryNodeObject... | a | assert | variable | tests/diagram_tests/binary_tree_diagram_test.py | test_replace_right_then_left_positions | TestBinaryTreeDiagramHelpers | 159 | null |
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.pie_chart import PieChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
class TestPie... | 300 | assert | numeric_literal | tests/diagram_tests/pie_chart_test.py | test_custom_size | TestPieChartBackgroundAndStyling | 330 | null |
MerrimanInd/drawpyo | import drawpyo
from pathlib import Path
import xml.etree.ElementTree as ET
import pytest
class TestFileAddPage:
def test_add_page_basic(self, empty_file: drawpyo.File) -> None:
"""Checks basic page addition"""
page = drawpyo.Page()
empty_file.add_page(page)
assert page.file == emp... | 1 | assert | numeric_literal | tests/file_test.py | test_add_page_basic | TestFileAddPage | 49 | null |
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.pie_chart import PieChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
class TestPie... | 5 | assert | numeric_literal | tests/diagram_tests/pie_chart_test.py | test_label_offset_constant | TestPieChartLabelPositioning | 496 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram_types.binary_tree import BinaryNodeObject, BinaryTreeDiagram
class TestBinaryTreeDiagramHelpers:
def test_replace_right_then_left_positions(self):
"""Moving an existing child from right to left reorders tree_children."""
parent = BinaryNodeObject... | b | assert | variable | tests/diagram_tests/binary_tree_diagram_test.py | test_replace_right_then_left_positions | TestBinaryTreeDiagramHelpers | 156 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.utils.standard_colors import StandardColor
def parse_style(style: str) -> dict[str, str]:
"""Convert a style string into a dict for order-independent comparison."""
if not style:
return {}
parts = style.sp... | None | assert | none_literal | tests/diagram_tests/object_test.py | test_standard_color_enum | TestObjectColors | 170 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import ColorScheme, StandardColor
def test_hierarchy_object_specific_over_scheme():
scheme = ColorScheme(fill_color="#111111")
obj = DummyObject(fill_color="#222222", color_scheme=scheme)
assert obj.resolved_fill() == | "#222222" | assert | string_literal | tests/diagram_tests/color_management_test.py | test_hierarchy_object_specific_over_scheme | 192 | null | |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram.edges import Edge, EdgeGeometry, EdgeLabel, Point
from drawpyo.utils.color_scheme import ColorScheme
class TestEdgeGeometry:
def test_entry_exit_points(self, empty_page: drawpyo.Page) -> None:
"""Checks entry and exit points"""
edge = Edge(
... | 1.0 | assert | numeric_literal | tests/diagram_tests/edge_test.py | test_entry_exit_points | TestEdgeGeometry | 143 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import ColorScheme, StandardColor
def test_hierarchy_scheme_used_when_object_specific_missing():
scheme = ColorScheme(stroke_color="#333333")
obj = DummyObject(color_scheme=scheme)
assert obj.resolved_stroke() == | "#333333" | assert | string_literal | tests/diagram_tests/color_management_test.py | test_hierarchy_scheme_used_when_object_specific_missing | 199 | null | |
MerrimanInd/drawpyo | import pytest
import drawpyo
from drawpyo.diagram_types.binary_tree import BinaryNodeObject, BinaryTreeDiagram
class TestBinaryTreeDiagramFromDict:
def test_from_dict_nested_structure(self):
"""Test a more complex nested dictionary structure."""
data = {
"A": {"B": ["D", None], "C": ... | c | assert | variable | tests/diagram_tests/binary_tree_diagram_test.py | test_from_dict_nested_structure | TestBinaryTreeDiagramFromDict | 258 | null |
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.pie_chart import PieChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
class TestPie... | data | assert | variable | tests/diagram_tests/pie_chart_test.py | test_negative_values | TestPieChartDataValidation | 91 | null |
MerrimanInd/drawpyo | import drawpyo
import pytest
class TestPageInit:
def test_page_size_presets(self) -> None:
"""Checks page dimensions when using a size preset"""
page = drawpyo.Page(
size_preset=drawpyo.PageSize.A4LANDSCAPE,
width=99,
)
assert page.scale == 1
assert... | 827 | assert | numeric_literal | tests/page_test.py | test_page_size_presets | TestPageInit | 53 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import ColorScheme, StandardColor
@pytest.mark.parametrize(
"value",
[
"#000000",
"#FFFFFF",
"#abcdef",
"#A1B2C3",
"#123abc",
],
)
def test_is_valid_hex_accepts_valid_hex(value):
assert ColorScheme.is_valid_hex(value) is | True | assert | bool_literal | tests/diagram_tests/color_management_test.py | test_is_valid_hex_accepts_valid_hex | 20 | null | |
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.bar_chart import BarChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
class TestBarChartAxisAndTicks:
def test_zero_tick_count(self):
"""Test zero tick count (no ticks)."""
... | 0 | assert | numeric_literal | tests/diagram_tests/bar_chart_test.py | test_zero_tick_count | TestBarChartAxisAndTicks | 239 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo.diagram_types.legend import Legend
from drawpyo.diagram.text_format import TextFormat
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.page import Page
from drawpyo.diagram.objects import Object, Group
def simple_mapping... | "Legend(items=2, position=(10, 20))" | assert | string_literal | tests/diagram_tests/legend_test.py | test_repr | TestLegendInit | 78 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import ColorScheme, StandardColor
@pytest.mark.parametrize(
"value",
[
"000000", # missing '#'
"#FFFFF", # 5 chars
"#FFFFFFF", # 7 chars
"#ZZZZZZ", # non-hex
"#12G45F", # invalid character
"#12345", # short
"#12345G", # w... | False | assert | bool_literal | tests/diagram_tests/color_management_test.py | test_is_valid_hex_rejects_invalid_hex_strings | 36 | null | |
MerrimanInd/drawpyo | import pytest
from drawpyo import load_diagram
from drawpyo.diagram import Object, Edge
SAMPLE_XML = """<mxfile host="Drawpyo">
<diagram name="Page-1">
<mxGraphModel dx="2037" dy="830" grid="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="100" value="List" style="swimlane" p... | 140 | assert | numeric_literal | tests/import_tests/test_import_drawio.py | test_geometry_parsing | TestDrawpyoParsing | 65 | null |
MerrimanInd/drawpyo | import pytest
from unittest.mock import Mock
from drawpyo.diagram_types.pie_chart import PieChart
from drawpyo.diagram.text_format import TextFormat
from drawpyo.diagram.objects import Object, Group
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
class TestPie... | 10 | assert | numeric_literal | tests/diagram_tests/pie_chart_test.py | test_custom_text_formats | TestPieChartTextFormatting | 294 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo import ColorScheme, StandardColor
def test_enum_allowed_in_setters():
scheme = ColorScheme()
scheme.set_stroke_color(StandardColor.WHITE)
assert scheme.stroke_color == | "#FFFFFF" | assert | string_literal | tests/diagram_tests/color_management_test.py | test_enum_allowed_in_setters | 66 | null | |
MerrimanInd/drawpyo | from unittest.mock import patch, mock_open
import pytest
import os
from pathlib import Path
from drawpyo.drawio_import.mxlibrary_parser import parse_mxlibrary, load_mxlibrary
import drawpyo
FIXTURES_DIR = Path(__file__).parent / "fixtures"
SAMPLE_LIBRARY_PATH = FIXTURES_DIR / "sample_library.xml"
OUTPUT_DIR = Path(__... | 50 | assert | numeric_literal | tests/import_tests/test_mxlibrary_import.py | test_load_mxlibrary_from_local_file | TestLoadMxlibrary | 71 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo.diagram_types.legend import Legend
from drawpyo.diagram.text_format import TextFormat
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.page import Page
from drawpyo.diagram.objects import Object, Group
def simple_mapping... | ox + 20 | assert | complex_expr | tests/diagram_tests/legend_test.py | test_move_updates_positions | TestLegendMove | 195 | null |
MerrimanInd/drawpyo | import pytest
import drawpyo
class TestTranslateTxt:
def test_translate_txt_basic(self) -> None:
"""Tests basic character replacement"""
result = drawpyo.XMLBase.translate_txt("abc", {"a": "X", "c": "Z"})
assert result == | "XbZ" | assert | string_literal | tests/xml_base_test.py | test_translate_txt_basic | TestTranslateTxt | 123 | null |
MerrimanInd/drawpyo | import pytest
from drawpyo.diagram_types.legend import Legend
from drawpyo.diagram.text_format import TextFormat
from drawpyo.utils.standard_colors import StandardColor
from drawpyo.utils.color_scheme import ColorScheme
from drawpyo.page import Page
from drawpyo.diagram.objects import Object, Group
def simple_mapping... | 4 | assert | numeric_literal | tests/diagram_tests/legend_test.py | test_default_values | TestLegendInit | 73 | null |
jackmpcollins/magentic | import collections.abc
import json
import typing
from collections import OrderedDict
from typing import Annotated, Any, Generic, TypeVar, get_origin
import pytest
from pydantic import BaseModel, Field, create_model
from magentic._pydantic import ConfigDict, with_config
from magentic.chat_model.function_schema import ... | json.loads(expected_args_str) | assert | func_call | tests/test_function_schema.py | test_any_function_schema_serialize_args | 174 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING
import pytest
from magentic._chat import Chat
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
UserMessage,
)
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.s... | [] | assert | collection | tests/test_chat.py | test_chat_add_message | 25 | null | |
jackmpcollins/magentic | import inspect
from typing import TYPE_CHECKING
import pytest
from typing_extensions import assert_type
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.streaming import async_iter
def plus(a: int, b: int) -> int:
return a + b
async ... | function_calls | assert | variable | tests/test_function_call.py | test_parallel_function_call_iter | 98 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | "gpt-4" | assert | string_literal | tests/test_prompt_function.py | test_decorator_with_context_manager | 323 | null | |
jackmpcollins/magentic | from typing_extensions import assert_type
from magentic.formatting import BulletedDict, BulletedList, NumberedDict, NumberedList
def test_numbered_dict():
items = NumberedDict({"foo": 1, "bar": 2, "baz": 3})
assert_type(items, NumberedDict[str, int])
assert f"{items}" == | "1. foo: 1\n2. bar: 2\n3. baz: 3" | assert | string_literal | tests/test_formatting.py | test_numbered_dict | 27 | null | |
jackmpcollins/magentic | import typing
from collections.abc import Iterable
from types import NoneType
from typing import Any, Generic, TypeVar
import pytest
from pydantic import BaseModel
from magentic.typing import (
is_any_origin_subclass,
is_origin_abstract,
is_origin_subclass,
name_type,
split_union_type,
)
@pytest.... | expected_name | assert | variable | tests/test_typing.py | test_name_type | 103 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | message_model_dump | assert | variable | tests/chat_model/test_message.py | test_message_model_dump | 66 | null | |
jackmpcollins/magentic | import pytest
from magentic.backend import get_chat_model
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.litellm_chat_model import LitellmChatModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.mistral_chat_model import ... | "gpt-5" | assert | string_literal | tests/test_backend.py | test_chat_model_context_within_context | 105 | null | |
jackmpcollins/magentic | import pytest
from pydantic import BaseModel
from magentic.chat_model.message import (
AssistantMessage,
SystemMessage,
Usage,
UserMessage,
)
from magentic.chat_model.mistral_chat_model import MistralChatModel
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
Par... | 2 | assert | numeric_literal | tests/chat_model/test_mistral_chat_model.py | test_mistral_chat_model_complete_parallel_function_call | 96 | null | |
jackmpcollins/magentic | import os
from typing import Annotated, Any
from unittest.mock import ANY
import openai
import pytest
from inline_snapshot import snapshot
from openai.types.chat import ChatCompletionMessageParam
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._strea... | 2 | assert | numeric_literal | tests/chat_model/test_openai_chat_model.py | test_openai_chat_model_complete_streamed_response | 322 | null | |
jackmpcollins/magentic | from collections.abc import AsyncIterator
import pytest
from magentic import AsyncStreamedStr, StreamedStr
from magentic.streaming import (
CachedAsyncIterable,
CachedIterable,
aapply,
adropwhile,
agroupby,
aiter_streamed_json_array,
apeek,
apply,
async_iter,
atakewhile,
az... | expected_first | assert | variable | tests/test_streaming.py | test_peek | 63 | null | |
jackmpcollins/magentic | from inspect import getdoc
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import BaseModel
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
ImageBytes,
Placeholder,
SystemMessage,
ToolResultMessage,
UserMessage,
)
from magentic.chatp... | "This is the docstring." | assert | string_literal | tests/test_chatprompt.py | test_chatprompt_decorator_docstring | 123 | null | |
jackmpcollins/magentic | import collections.abc
import json
import typing
from collections import OrderedDict
from typing import Annotated, Any, Generic, TypeVar, get_origin
import pytest
from pydantic import BaseModel, Field, create_model
from magentic._pydantic import ConfigDict, with_config
from magentic.chat_model.function_schema import ... | 4 | assert | numeric_literal | tests/test_function_schema.py | test_function_call_function_schema_with_default_value | 836 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING
import pytest
from magentic._chat import Chat
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
UserMessage,
)
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.s... | UserMessage(content="Hello") | assert | func_call | tests/test_chat.py | test_chat_submit | 41 | null | |
jackmpcollins/magentic | import pytest
from typing_extensions import assert_type
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.message import Placeholder, UserMessage
from magentic.chat_model.openai_chat_model import (
OpenaiChatModel,
message_to_openai_message,
)
from magentic.chatpr... | UserImageMessage[bytes]) | assert_* | complex_expr | tests/test_vision.py | test_user_image_message_format_placeholder | 29 | null | |
jackmpcollins/magentic | import inspect
from typing import TYPE_CHECKING
import pytest
from typing_extensions import assert_type
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
ParallelFunctionCall,
)
from magentic.streaming import async_iter
def plus(a: int, b: int) -> int:
return a + b
async ... | tuple[int, ...]) | assert_* | complex_expr | tests/test_function_call.py | test_async_parallel_function_call_call | 110 | null | |
jackmpcollins/magentic | import typing
from collections.abc import Iterable
from types import NoneType
from typing import Any, Generic, TypeVar
import pytest
from pydantic import BaseModel
from magentic.typing import (
is_any_origin_subclass,
is_origin_abstract,
is_origin_subclass,
name_type,
split_union_type,
)
@pytest.... | expected_result | assert | variable | tests/test_typing.py | test_is_origin_abstract | 39 | null | |
jackmpcollins/magentic | import pytest
from typing_extensions import assert_type
from magentic.chat_model.anthropic_chat_model import AnthropicChatModel
from magentic.chat_model.message import Placeholder, UserMessage
from magentic.chat_model.openai_chat_model import (
OpenaiChatModel,
message_to_openai_message,
)
from magentic.chatpr... | UserImageMessage("https://example.com/image.jpg") | assert | func_call | tests/test_vision.py | test_user_image_message_format_noop | 21 | null | |
jackmpcollins/magentic | import typing
from collections.abc import Iterable
from types import NoneType
from typing import Any, Generic, TypeVar
import pytest
from pydantic import BaseModel
from magentic.typing import (
is_any_origin_subclass,
is_origin_abstract,
is_origin_subclass,
name_type,
split_union_type,
)
@pytest.... | expected_types | assert | variable | tests/test_typing.py | test_split_union_type | 27 | null | |
jackmpcollins/magentic | import asyncio
from collections.abc import Iterator
from typing import Annotated, Any
import litellm
import pytest
from litellm.integrations.custom_logger import CustomLogger
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.base import ToolSchemaParseError
from magentic.chat_model.litellm_chat_... | {"foo": "bar"} | assert | collection | tests/chat_model/test_litellm_chat_model.py | test_litellm_chat_model_metadata | 70 | null | |
jackmpcollins/magentic | import os
from typing import Annotated, Any
from unittest.mock import ANY
import openai
import pytest
from inline_snapshot import snapshot
from openai.types.chat import ChatCompletionMessageParam
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._strea... | message2.content | assert | complex_expr | tests/chat_model/test_openai_chat_model.py | test_openai_chat_model_complete_seed | 292 | null | |
jackmpcollins/magentic | import json
import os
from collections.abc import Iterator
from itertools import count
from pathlib import Path
from typing import Any
from uuid import UUID
import pytest
from dotenv import load_dotenv
from pytest_mock import MockerFixture
from vcr import VCR
from vcr.request import Request
def _load_dotenv():
""... | json.loads(r2.body) | assert | func_call | tests/conftest.py | is_json_body_equal | 33 | null | |
jackmpcollins/magentic | import pytest
from pydantic import BaseModel
from magentic.chat_model.message import (
AssistantMessage,
SystemMessage,
Usage,
UserMessage,
)
from magentic.chat_model.mistral_chat_model import MistralChatModel
from magentic.function_call import (
AsyncParallelFunctionCall,
FunctionCall,
Par... | 0 | assert | numeric_literal | tests/chat_model/test_mistral_chat_model.py | test_mistral_chat_model_complete_usage | 45 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | None | assert | none_literal | tests/chat_model/test_message.py | test_assistant_message_usage | 197 | null | |
jackmpcollins/magentic | from typing import TYPE_CHECKING, Literal, cast
from unittest.mock import ANY, MagicMock
import pytest
from inline_snapshot import snapshot
from pydantic import BaseModel, TypeAdapter, ValidationError
from typing_extensions import assert_type
from magentic.chat_model.message import (
AnyMessage,
AssistantMess... | "image/jpeg" | assert | string_literal | tests/chat_model/test_message.py | test_image_bytes_jpg | 90 | null | |
jackmpcollins/magentic | import os
from typing import Annotated, Any
from unittest.mock import ANY
import openai
import pytest
from inline_snapshot import snapshot
from openai.types.chat import ChatCompletionMessageParam
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._strea... | 1 | assert | numeric_literal | tests/chat_model/test_openai_chat_model.py | test_openai_chat_model_complete_streamed_response | 325 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | "gpt-4o" | assert | string_literal | tests/test_prompt_function.py | test_decorator_with_context_manager | 322 | null | |
jackmpcollins/magentic | from collections.abc import Awaitable
from inspect import getdoc
from typing import Annotated
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import AfterValidator, BaseModel
from magentic.chat_model.message import AssistantMessage, UserMessage
from magentic.chat_model.openai_chat_model import O... | [str, bool] | assert | collection | tests/test_prompt_function.py | test_promptfunction_call | 57 | null | |
jackmpcollins/magentic | from inspect import getdoc
from unittest.mock import AsyncMock, Mock
import pytest
from pydantic import BaseModel
from magentic.chat_model.message import (
AssistantMessage,
FunctionResultMessage,
ImageBytes,
Placeholder,
SystemMessage,
ToolResultMessage,
UserMessage,
)
from magentic.chatp... | 1 | assert | numeric_literal | tests/test_chatprompt.py | test_chatpromptfunction_call | 108 | null | |
jackmpcollins/magentic | import os
from typing import Annotated
import openai
import pytest
from pydantic import AfterValidator, BaseModel
from magentic._pydantic import ConfigDict, with_config
from magentic._streamed_response import AsyncStreamedResponse, StreamedResponse
from magentic.chat_model.base import ToolSchemaParseError
from magent... | 2 | assert | numeric_literal | tests/chat_model/test_openrouter_chat_model.py | test_openrouter_chat_model_complete_streamed_response | 68 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.