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 |
|---|---|---|---|---|---|---|---|---|---|
nschloe/tikzplotlib | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def rot(theta):
"""Get a stack of rotation matrices"""
return np.stack(
[
np.stack([np.cos(theta), -np.sin(theta)], axis=-1),
np.stack([np.sin(theta), np.cos(theta)], axis=-1),
],
axis=-2,
)... | "test_custom_collection_reference.tex") | assert_* | string_literal | tests/test_custom_collection.py | test | 77 | null | |
nschloe/tikzplotlib | import datetime as date
import matplotlib.pyplot as plt
from matplotlib import dates
def plot():
fig = plt.figure()
times = [date.datetime(2020, 1, 1, 12, 00), date.datetime(2020, 1, 2, 12, 00)]
line = [2, 2]
upper = [3, 4]
lower = [1, 0]
plt.plot(times, line)
plt.fill_between(times, low... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_datetime_paths.py | test | 26 | null | |
nschloe/tikzplotlib | def plot():
import numpy as np
from matplotlib import pyplot as plt
x = np.linspace(0 * np.pi, 2 * np.pi, 128)
y = np.linspace(0 * np.pi, 2 * np.pi, 128)
X, Y = np.meshgrid(x, y)
nu = 1e-5
def F(t):
return np.exp(-2 * nu * t)
def u(x, y, t):
return np.sin(x) * np.cos(y... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_quadmesh.py | test | 35 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure()
np.random.seed(123)
s = np.random.normal(0, 1, 10)
plt.gca().set_ylim(-1.0, +1.0)
plt.hist(s, 30)
plt.axvline(1.96)
return fig
def test():
from .helpers import assert_equality
assert_equality(plot, | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_axvline.py | test | 18 | null | |
nschloe/tikzplotlib | def plot():
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure()
with plt.style.context("ggplot"):
t = np.arange(0.0, 2.0, 0.1)
s = np.sin(2 * np.pi * t)
s2 = np.cos(2 * np.pi * t)
A = plt.cm.jet(np.linspace(0, 1, 10))
plt.plot(t, s, "o-", l... | "test_externalize_tables_reference.tex") | assert_* | string_literal | tests/test_externalize_tables.py | test | 24 | null | |
nschloe/tikzplotlib | def plot():
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure()
with plt.style.context("fivethirtyeight"):
np.random.seed(123)
plt.scatter(
np.linspace(0, 100, 101),
np.linspace(0, 100, 101) + 15 * np.random.rand(101),
)
return ... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_scatter.py | test | 18 | null | |
nschloe/tikzplotlib | import pathlib
import matplotlib.pyplot as plt
def plot():
import matplotlib.image as mpimg
from matplotlib import rcParams
this_dir = pathlib.Path(__file__).resolve().parent
img = mpimg.imread(this_dir / "lena.png")
dpi = rcParams["figure.dpi"]
figsize = img.shape[0] / dpi, img.shape[1] / d... | "test_image_plot_lower_reference.tex") | assert_* | string_literal | tests/test_image_plot_lower.py | test | 32 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
# Make plot with vertical (default) colorbar
fig = plt.figure()
ax = fig.add_subplot(111)
np.random.seed(123)
ax.hist(10 + 2 * np.random.randn(1000), label="men")
ax.hist(12 + 3 * np.random.randn(1000), label="women", alpha=0.5)
... | "test_histogram_reference.tex") | assert_* | string_literal | tests/test_histogram.py | test | 20 | null | |
nschloe/tikzplotlib | def plot():
from matplotlib import pyplot as plt
x = [1, 2, 3, 4]
y = [1, 4, 9, 6]
fig = plt.figure()
ax = plt.subplot(4, 4, 1)
plt.plot(x, y, "ro")
plt.tick_params(axis="x", which="both", bottom="off", top="off")
plt.tick_params(axis="y", which="both", left="off", right="off")
a... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_tick_positions.py | test | 95 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
da = np.zeros((3, 3))
da[:2, :2] = 1.0
fig = plt.figure()
ax = plt.gca()
im = ax.imshow(da, cmap="viridis")
plt.colorbar(im, aspect=5, shrink=0.5)
return fig
def test():
from .helpers import assert_equality
assert_e... | "test_fancy_colorbar_reference.tex") | assert_* | string_literal | tests/test_fancy_colorbar.py | test | 20 | null | |
nschloe/tikzplotlib | def plot():
# Example from
# <http://matplotlib.org/examples/pylab_examples/line_collection2.html>
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.collections import LineCollection
fig = plt.figure()
# In order to efficiently plot many lines in a single set of axes,
... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_line_collection.py | test | 51 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
fig, ax = plt.subplots()
with plt.style.context("ggplot"):
t = np.linspace(0, 2 * np.pi, 11)
s = np.sin(t)
c = np.cos(t)
s2 = np.sin(2 * t)
ax.plot(t, s, "ko-", mec="r", markevery=2, markersize=3)
ax.... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_marker.py | test | 26 | null | |
nschloe/tikzplotlib | import os
import pathlib
import subprocess
import tempfile
import matplotlib
import matplotlib.pyplot as plt
import tikzplotlib
def print_tree(obj, indent=""):
"""Recursively prints the tree structure of the matplotlib object."""
if isinstance(obj, matplotlib.text.Text):
print(indent, type(obj).__nam... | code | assert | variable | tests/helpers.py | assert_equality | 48 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
fig, axes = plt.subplots(2, 2, sharex=True, sharey=True, figsize=(8, 5))
t = np.arange(0.0, 5.0, 0.1)
s = np.cos(2 * np.pi * t)
axes[0][0].plot(t, s, color="blue")
axes[0][1].plot(t, s, color="red")
axes[1][0].plot(t, s, color="gree... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_sharex_and_y.py | test | 19 | null | |
nschloe/tikzplotlib | def plot():
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure()
x = np.ma.arange(0, 2 * np.pi, 0.4)
y = np.ma.sin(x)
y1 = np.sin(2 * x)
y2 = np.sin(3 * x)
ym1 = np.ma.masked_where(y1 > 0.5, y1)
ym2 = np.ma.masked_where(y2 < -0.5, y2)
lines = plt.plot(x, ... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_legends.py | test | 27 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure()
ax = fig.add_subplot(111)
dat = np.linspace(0, 10, 20)
ax.plot(dat, dat**2)
ax2 = ax.twinx()
ax2.plot(20 * dat, 20 * dat**2)
ax.xaxis.tick_top()
return fig
def test():
from .helpers import assert_equa... | "test_dual_axis_reference.tex") | assert_* | string_literal | tests/test_dual_axis.py | test | 19 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
def plot():
# plot data
fig = plt.figure()
ax = fig.add_subplot(111)
x = [7.14, 7.36, 7.47, 7.52]
y = [3.3, 4.4, 8.8, 5.5]
ystd = [0.1, 0.5, 0.8, 0.3]
ax.errorbar(x, y, yerr=ystd)
return fig
def test():
from .helpers import assert_equality
as... | "test_errorbar_reference.tex") | assert_* | string_literal | tests/test_errorbar.py | test | 20 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
nbins = 5
fig = plt.figure()
ax = plt.gca()
x_max = 2
x_min = 0
y_max = 2
y_min = 0
xi, yi = np.mgrid[x_min : x_max : nbins * 1j, y_min : y_max : nbins * 1j]
pos = np.empty(xi.shape + (2,))
pos[:, :, 0] = xi
p... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_contourf.py | test | 31 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
from matplotlib.patches import FancyBboxPatch
bb = mtransforms.Bbox([[0.3, 0.4], [0.7, 0.6]])
def draw_bbox(ax, bb_obj):
# boxstyle=square with pad=0, i.e. bbox itself.
p_bbox = FancyBboxPatch(
(bb_obj.xmin, bb_obj.ymin),
... | "test_fancybox_reference.tex") | assert_* | string_literal | tests/test_fancybox.py | test | 200 | null | |
nschloe/tikzplotlib | def plot():
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure()
an = np.linspace(0, 2 * np.pi, 10)
plt.subplot(221)
plt.plot(3 * np.cos(an), 3 * np.sin(an))
plt.title("not equal, looks like ellipse", fontsize=10)
plt.subplot(222)
plt.plot(3 * np.cos(an), 3 ... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_subplot4x4.py | test | 37 | null | |
nschloe/tikzplotlib | import numpy as np
import pytest
from matplotlib import pyplot as plt
from tikzplotlib import clean_figure, get_tikz_code
RC_PARAMS = {"figure.figsize": [5, 5], "figure.dpi": 220, "pgf.rcfonts": False}
class Test_lineplot_markers:
def test_sine(self):
x = np.linspace(1, 2 * np.pi, 100)
y = np.si... | 39 | assert | numeric_literal | tests/test_cleanfigure.py | test_sine | Test_lineplot_markers | 463 | null |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
def plot():
# plot data
fig = plt.figure()
ax = fig.add_subplot(111)
data = [
[
0.8792419963142024,
0.8842648555256405,
0.8830545971510088,
0.8831310510125482,
0.8839926059865629,
0.87958150... | "test_boxplot_reference.tex") | assert_* | string_literal | tests/test_boxplot.py | test | 93 | null | |
nschloe/tikzplotlib | import numpy as np
import pytest
from matplotlib import pyplot as plt
from tikzplotlib import clean_figure, get_tikz_code
RC_PARAMS = {"figure.figsize": [5, 5], "figure.dpi": 220, "pgf.rcfonts": False}
class Test_logscale:
def test_ylog_2(self):
x = np.arange(1, 100)
y = np.arange(1, 100)
... | 51 | assert | numeric_literal | tests/test_cleanfigure.py | test_ylog_2 | Test_logscale | 587 | null |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
def plot():
_, ax = plt.subplots()
ax.scatter(
[1, 2, 3],
[5, 7, 1],
s=[300, 300, 300],
facecolors="none",
edgecolors="black",
linewidths=3.0,
)
def test():
from .helpers import assert_equality
assert_equality(plot, | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_scatter_different_sizes.py | test | 20 | null | |
nschloe/tikzplotlib | import numpy as np
import pytest
from matplotlib import pyplot as plt
from tikzplotlib import clean_figure, get_tikz_code
RC_PARAMS = {"figure.figsize": [5, 5], "figure.dpi": 220, "pgf.rcfonts": False}
class Test_logscale:
def test_ylog(self):
x = np.linspace(0, 3, 100)
y = np.exp(x)
wit... | 98 | assert | numeric_literal | tests/test_cleanfigure.py | test_ylog | Test_logscale | 533 | null |
nschloe/tikzplotlib | def plot():
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure()
np.random.seed(123)
plt.scatter(
np.random.randn(10),
np.random.randn(10),
np.random.rand(10) * 90 + 10,
np.random.randn(10),
)
return fig
def test():
from .helpers im... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_scatter_colormap.py | test | 19 | null | |
nschloe/tikzplotlib | import numpy as np
import pytest
from matplotlib import pyplot as plt
from tikzplotlib import clean_figure, get_tikz_code
RC_PARAMS = {"figure.figsize": [5, 5], "figure.dpi": 220, "pgf.rcfonts": False}
class Test_plottypes:
def test_plot(self):
x = np.linspace(1, 100, 20)
y = np.linspace(1, 100,... | 18 | assert | numeric_literal | tests/test_cleanfigure.py | test_plot | Test_plottypes | 33 | null |
nschloe/tikzplotlib | def plot():
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure()
x = np.ma.arange(0, 2 * np.pi, 0.4)
y1 = np.sin(1 * x)
y2 = np.sin(2 * x)
y3 = np.sin(3 * x)
plt.plot(x, y1, label="y1")
plt.plot(x, y2, label=None)
plt.plot(x, y3, label="y4")
plt.legen... | "test_legend_labels_reference.tex") | assert_* | string_literal | tests/test_legend_labels.py | test | 23 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure(1, figsize=(8, 5))
ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-4, 3))
t = np.arange(0.0, 5.0, 0.2)
s = np.cos(2 * np.pi * t)
ax.plot(t, s, color="blue")
ax.annotate(
"text",
xy... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_annotate.py | test | 40 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure()
N = 10
t = np.linspace(0, 1, N)
x = np.arange(N)
plt.plot(t, x, "-o", fillstyle="none")
plt.tight_layout()
return fig
def test():
from .helpers import assert_equality
assert_equality(plot, | "test_fillstyle_reference.tex") | assert_* | string_literal | tests/test_fillstyle.py | test | 19 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
def plot():
fig = plt.figure()
axis = fig.add_subplot(1, 1, 1)
col = PolyCollection(
[], facecolors="none", edgecolors="red", linestyle="--", linewidth=1.2
)
col.set_zorder(1)
axis.add_collection(col)
... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_patch_styles.py | test | 23 | null | |
nschloe/tikzplotlib | def plot():
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure()
with plt.style.context("ggplot"):
t = np.arange(0.0, 2.0, 0.1)
s = np.sin(2 * np.pi * t)
s2 = np.cos(2 * np.pi * t)
plt.plot(t, s, ".-", lw=1.5, color="C0")
plt.plot(t, s2, "^-... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_line_color_marker.py | test | 23 | null | |
nschloe/tikzplotlib | import os
import pathlib
import subprocess
import tempfile
import matplotlib
import matplotlib.pyplot as plt
import tikzplotlib
def print_tree(obj, indent=""):
"""Recursively prints the tree structure of the matplotlib object."""
if isinstance(obj, matplotlib.text.Text):
print(indent, type(obj).__nam... | None | assert | none_literal | tests/helpers.py | assert_equality | 59 | null | |
nschloe/tikzplotlib | import matplotlib as mpl
import matplotlib.pyplot as plt
def plot():
# Make a figure and axes with dimensions as desired.
fig, ax = plt.subplots(3)
# Set the colormap and norm to correspond to the data for which the colorbar will be
# used.
cmap = mpl.cm.cool
norm = mpl.colors.Normalize(vmin=-... | "test_colorbars_reference.tex") | assert_* | string_literal | tests/test_colorbars.py | test | 78 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import pandas as pd
def plot():
fig = plt.figure(1, figsize=(8, 5))
df = pd.DataFrame(index=["one", "two", "three"], data={"data": [1, 2, 3]})
plt.plot(df, "o")
return fig
def test():
from .helpers import assert_equality
assert_equality(plot, | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_pandas_dataframe.py | test | 15 | null | |
nschloe/tikzplotlib | import pathlib
import matplotlib.pyplot as plt
import pytest
def plot():
import matplotlib.image as mpimg
from matplotlib import rcParams
this_dir = pathlib.Path(__file__).resolve().parent
img = mpimg.imread(this_dir / "lena.png")
dpi = rcParams["figure.dpi"]
figsize = img.shape[0] / dpi, im... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_image_plot_upper.py | test | 36 | null | |
nschloe/tikzplotlib | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure()
x, y = np.ogrid[-10:10:100j, -10:10:100j]
extent = (x.min(), x.max(), y.min(), y.max())
cmap = matplotlib.cm.get_cmap("gray")
plt.imshow(x * y, extent=extent, cmap=cmap)
plt.colorbar()
return... | "test_heat_reference.tex") | assert_* | string_literal | tests/test_heat.py | test | 19 | null | |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
def plot():
fig = plt.figure()
linestyles = ["-", "--", "-.", ":", (0, (10, 1)), (5, (10, 1)), (0, (1, 2, 3, 4))]
for idx, ls in enumerate(linestyles):
plt.plot([idx, idx + 1], linestyle=ls)
return fig
def test():
from .helpers import assert_equality
a... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_line_dashes.py | test | 15 | null | |
nschloe/tikzplotlib | def plot():
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
x, y = np.meshgrid(np.linspace(0, 1), np.linspace(0, 1))
z = x**2 - y**2
fig = plt.figure()
plt.pcolormesh(x, y, z, cmap=cm.viridis, shading="gouraud")
# plt.colorbar()
return fig
def test()... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_viridis.py | test | 20 | null | |
nschloe/tikzplotlib | def plot():
import numpy as np
from matplotlib import pyplot as plt
fig, ax = plt.subplots(3, 3, sharex="col", sharey="row")
axes = [ax[i][j] for i in range(len(ax)) for j in range(len(ax[i]))]
for k, loc in enumerate(range(2, 11)):
t1 = np.arange(0.0, 2.0, 0.4)
t2 = np.arange(0.0, ... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_legends2.py | test | 25 | null | |
nschloe/tikzplotlib | import pytest
def plot():
"""
Hatch demo code from
https://matplotlib.org/3.1.1/gallery/shapes_and_collections/hatch_demo.html
Slightly modified to test more aspects of the hatch implementation
"""
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse, Polygon
fig, (a... | "test_hatch_reference.tex") | assert_* | string_literal | tests/test_hatch.py | test | 63 | null | |
nschloe/tikzplotlib | import numpy as np
import pytest
from matplotlib import pyplot as plt
from tikzplotlib import clean_figure, get_tikz_code
RC_PARAMS = {"figure.figsize": [5, 5], "figure.dpi": 220, "pgf.rcfonts": False}
class Test_logscale:
def test_loglog_2(self):
x = np.arange(1, 100)
y = np.arange(1, 100)
... | 97 | assert | numeric_literal | tests/test_cleanfigure.py | test_loglog_2 | Test_logscale | 622 | null |
nschloe/tikzplotlib | import numpy as np
import pytest
from matplotlib import pyplot as plt
from tikzplotlib import clean_figure, get_tikz_code
RC_PARAMS = {"figure.figsize": [5, 5], "figure.dpi": 220, "pgf.rcfonts": False}
class Test_plottypes:
def test_scatter3d(self):
theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
... | 14 | assert | numeric_literal | tests/test_cleanfigure.py | test_scatter3d | Test_plottypes | 145 | null |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure()
np.random.seed(123)
n = 4
plt.scatter(
np.random.rand(n),
np.random.rand(n),
color=np.array(
[
[1.0, 0.6, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.... | __file__[:-3] + "_reference.tex") | assert_* | complex_expr | tests/test_scatter_different_colors.py | test | 35 | null | |
nschloe/tikzplotlib | import numpy as np
import pytest
from matplotlib import pyplot as plt
from tikzplotlib import clean_figure, get_tikz_code
RC_PARAMS = {"figure.figsize": [5, 5], "figure.dpi": 220, "pgf.rcfonts": False}
class Test_logscale:
def test_ylog_2(self):
x = np.arange(1, 100)
y = np.arange(1, 100)
... | 72 | assert | numeric_literal | tests/test_cleanfigure.py | test_ylog_2 | Test_logscale | 588 | null |
nschloe/tikzplotlib | import matplotlib.pyplot as plt
import numpy as np
def plot():
# plot data
fig = plt.figure()
ax = fig.add_subplot(111)
x = np.arange(3)
y1 = [1, 2, 3]
y2 = [3, 2, 4]
y3 = [5, 3, 1]
w = 0.25
ax.bar(x - w, y1, w, color="b", align="center", label="Data 1")
ax.bar(x, y2, w, color... | "test_barchart_legend_reference.tex") | assert_* | string_literal | tests/test_barchart_legend.py | test | 36 | null | |
nschloe/tikzplotlib | import numpy as np
import pytest
from matplotlib import pyplot as plt
from tikzplotlib import clean_figure, get_tikz_code
RC_PARAMS = {"figure.figsize": [5, 5], "figure.dpi": 220, "pgf.rcfonts": False}
class Test_subplots:
def test_subplot(self):
"""octave code
```octave
addpath ("../... | 36 | assert | numeric_literal | tests/test_cleanfigure.py | test_subplot | Test_subplots | 514 | null |
coderamp-labs/gitingest | from __future__ import annotations
import pytest
from gitingest.config import MAX_FILE_SIZE
from gitingest.query_parser import parse_remote_repo
from gitingest.utils.query_parser_utils import KNOWN_GIT_HOSTS, _is_valid_git_commit_hash
_REPOS: list[tuple[str, str, str]] = [
("github.com", "fastapi", "fastapi"),
... | actual | assert | variable | tests/query_parser/test_git_host_agnostic.py | test_parse_query_without_host | 60 | null | |
coderamp-labs/gitingest | import pytest
from gitingest.utils.notebook import process_notebook
from tests.conftest import WriteNotebookFunc
def test_process_notebook_multiple_worksheets(write_notebook: WriteNotebookFunc) -> None:
"""Test a notebook containing multiple ``worksheets``.
Given a notebook with two worksheets:
- First... | result_multi | assert | variable | tests/test_notebook_utils.py | test_process_notebook_multiple_worksheets | 114 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import sys
from typing import TYPE_CHECKING
import pytest
from gitingest.clone import clone_repo
from gitingest.schemas import CloneConfig
from gitingest.utils.git_utils import check_repo_exists
from tests.conftest import DEMO_URL, LOCAL_REPO_PATH
pytestmark = pytest.mark.usefixtu... | "--depth=1") | assert_* | string_literal | tests/test_clone.py | test_clone_with_include_submodules | 205 | null | |
coderamp-labs/gitingest | import pytest
from gitingest.utils.notebook import process_notebook
from tests.conftest import WriteNotebookFunc
def test_process_notebook_multiple_worksheets(write_notebook: WriteNotebookFunc) -> None:
"""Test a notebook containing multiple ``worksheets``.
Given a notebook with two worksheets:
- First... | result_single | assert | variable | tests/test_notebook_utils.py | test_process_notebook_multiple_worksheets | 110 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import re
from typing import TYPE_CHECKING, TypedDict
import pytest
from gitingest.ingestion import ingest_query
def test_run_ingest_query(temp_directory: Path, sample_query: IngestionQuery) -> None:
"""Test ``ingest_query`` to ensure it processes the directory and returns exp... | summary | assert | variable | tests/test_ingestion.py | test_run_ingest_query | 35 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from inspect import signature
from pathlib import Path
import pytest
from click.testing import CliRunner, Result
from gitingest.__main__ import main
from gitingest.config import MAX_FILE_SIZE, OUTPUT_FILE_NAME
@pytest.mark.parametrize(
("cli_args", "expect_file"),
[
... | stdout_lines | assert | variable | tests/test_cli.py | test_cli_writes_file | 55 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Callable
import pytest
from gitingest.query_parser import parse_local_dir_path, parse_remote_repo
from gitingest.utils.query_parser_utils import _is_valid_git_commit_hash
from tests.conftest import DEMO_URL
URLS_HTTPS: lis... | url | assert | variable | tests/query_parser/test_query_parser.py | test_parse_url_valid_https | 46 | null | |
coderamp-labs/gitingest | from gitingest.utils.ignore_patterns import DEFAULT_IGNORE_PATTERNS
from gitingest.utils.pattern_utils import _parse_patterns, process_patterns
def test_parse_patterns_valid() -> None:
"""Test ``_parse_patterns`` with valid comma-separated patterns.
Given patterns like "*.py, *.md, docs/*":
When ``_parse_... | {"*.py", "*.md", "docs/*"} | assert | collection | tests/test_pattern_utils.py | test_parse_patterns_valid | 30 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Callable
import pytest
from gitingest.query_parser import parse_local_dir_path, parse_remote_repo
from gitingest.utils.query_parser_utils import _is_valid_git_commit_hash
from tests.conftest import DEMO_URL
URLS_HTTPS: lis... | "blob" | assert | string_literal | tests/query_parser/test_query_parser.py | test_parse_query_with_branch | 289 | null | |
coderamp-labs/gitingest | from gitingest.utils.ignore_patterns import DEFAULT_IGNORE_PATTERNS
from gitingest.utils.pattern_utils import _parse_patterns, process_patterns
def test_process_patterns_include_and_ignore_overlap() -> None:
"""Test ``process_patterns`` with overlapping patterns.
Given include="*.py" and ignore={"*.py", "*.tx... | {"*.py"} | assert | collection | tests/test_pattern_utils.py | test_process_patterns_include_and_ignore_overlap | 42 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Callable
import pytest
from gitingest.query_parser import parse_local_dir_path, parse_remote_repo
from gitingest.utils.query_parser_utils import _is_valid_git_commit_hash
from tests.conftest import DEMO_URL
URLS_HTTPS: lis... | "repo" | assert | string_literal | tests/query_parser/test_query_parser.py | test_parse_query_basic | 85 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Callable
import pytest
from gitingest.query_parser import parse_local_dir_path, parse_remote_repo
from gitingest.utils.query_parser_utils import _is_valid_git_commit_hash
from tests.conftest import DEMO_URL
URLS_HTTPS: lis... | "2.2.x" | assert | string_literal | tests/query_parser/test_query_parser.py | test_parse_query_with_branch | 286 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import sys
from typing import TYPE_CHECKING
import pytest
from gitingest.clone import clone_repo
from gitingest.schemas import CloneConfig
from gitingest.utils.git_utils import check_repo_exists
from tests.conftest import DEMO_URL, LOCAL_REPO_PATH
pytestmark = pytest.mark.usefixtu... | clone_config.url) | assert_* | complex_expr | tests/test_clone.py | test_clone_with_commit | 51 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Callable
import pytest
from gitingest.query_parser import parse_local_dir_path, parse_remote_repo
from gitingest.utils.query_parser_utils import _is_valid_git_commit_hash
from tests.conftest import DEMO_URL
URLS_HTTPS: lis... | "user" | assert | string_literal | tests/query_parser/test_query_parser.py | test_parse_query_basic | 84 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import pytest
from gitingest.config import MAX_FILE_SIZE
from gitingest.query_parser import parse_remote_repo
from gitingest.utils.query_parser_utils import KNOWN_GIT_HOSTS, _is_valid_git_commit_hash
_REPOS: list[tuple[str, str, str]] = [
("github.com", "fastapi", "fastapi"),
... | ValueError, match="Could not find a valid repository host") | pytest.raises | complex_expr | tests/query_parser/test_git_host_agnostic.py | test_parse_query_without_host | 51 | null | |
coderamp-labs/gitingest | import re
from pathlib import Path
import pytest
from gitingest import ingest
REPO = "pallets/flask"
PATH_CASES = [
("tree", "/examples/celery"),
("blob", "/examples/celery/make_celery.py"),
("blob", "/.gitignore"),
]
REF_CASES = [
("Branch", "main"),
("Branch", "stable"),
("Tag", "3.0.3"),... | REPO | assert | variable | tests/test_summary.py | test_ingest_summary | 63 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from inspect import signature
from pathlib import Path
import pytest
from click.testing import CliRunner, Result
from gitingest.__main__ import main
from gitingest.config import MAX_FILE_SIZE, OUTPUT_FILE_NAME
def test_cli_with_stdout_output() -> None:
"""Test CLI invocation w... | result.stdout | assert | complex_expr | tests/test_cli.py | test_cli_with_stdout_output | 74 | null | |
coderamp-labs/gitingest | import re
from pathlib import Path
import pytest
from gitingest import ingest
REPO = "pallets/flask"
PATH_CASES = [
("tree", "/examples/celery"),
("blob", "/examples/celery/make_celery.py"),
("blob", "/.gitignore"),
]
REF_CASES = [
("Branch", "main"),
("Branch", "stable"),
("Tag", "3.0.3"),... | ref | assert | variable | tests/test_summary.py | test_ingest_summary | 69 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import sys
from typing import TYPE_CHECKING
import pytest
from gitingest.clone import clone_repo
from gitingest.schemas import CloneConfig
from gitingest.utils.git_utils import check_repo_exists
from tests.conftest import DEMO_URL, LOCAL_REPO_PATH
pytestmark = pytest.mark.usefixtu... | commit_hash) | assert_* | variable | tests/test_clone.py | test_clone_with_commit | 66 | null | |
coderamp-labs/gitingest | import pytest
from gitingest.utils.notebook import process_notebook
from tests.conftest import WriteNotebookFunc
def test_process_notebook_all_cells(write_notebook: WriteNotebookFunc) -> None:
"""Test processing a notebook containing markdown, code, and raw cells.
Given a notebook with:
- One markdown ... | result | assert | variable | tests/test_notebook_utils.py | test_process_notebook_all_cells | 40 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Callable
import pytest
from gitingest.query_parser import parse_local_dir_path, parse_remote_repo
from gitingest.utils.query_parser_utils import _is_valid_git_commit_hash
from tests.conftest import DEMO_URL
URLS_HTTPS: lis... | None | assert | none_literal | tests/query_parser/test_query_parser.py | test_parse_local_dir_path_local_path | 156 | null | |
coderamp-labs/gitingest | from gitingest.utils.ignore_patterns import DEFAULT_IGNORE_PATTERNS
from gitingest.utils.pattern_utils import _parse_patterns, process_patterns
def test_process_patterns_include_and_ignore_overlap() -> None:
"""Test ``process_patterns`` with overlapping patterns.
Given include="*.py" and ignore={"*.py", "*.tx... | exclude_patterns | assert | variable | tests/test_pattern_utils.py | test_process_patterns_include_and_ignore_overlap | 44 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import base64
from typing import TYPE_CHECKING
import pytest
from gitingest.utils.exceptions import InvalidGitHubTokenError
from gitingest.utils.git_utils import create_git_auth_header, create_git_repo, is_github_host, validate_github_token
@pytest.mark.parametrize(
("local_pa... | auth_config_call[0] | assert | complex_expr | tests/test_git_utils.py | test_create_git_repo_with_ghe_urls | 252 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from inspect import signature
from pathlib import Path
import pytest
from click.testing import CliRunner, Result
from gitingest.__main__ import main
from gitingest.config import MAX_FILE_SIZE, OUTPUT_FILE_NAME
@pytest.mark.parametrize(
("cli_args", "expect_file"),
[
... | expectes_exit_code | assert | variable | tests/test_cli.py | test_cli_writes_file | 51 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import re
from typing import TYPE_CHECKING, TypedDict
import pytest
from gitingest.ingestion import ingest_query
@pytest.mark.parametrize(
"pattern_scenario",
[
pytest.param(
PatternScenario(
{
"include_patterns": {"f... | None | assert | none_literal | tests/test_ingestion.py | test_include_ignore_patterns | 222 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from inspect import signature
from pathlib import Path
import pytest
from click.testing import CliRunner, Result
from gitingest.__main__ import main
from gitingest.config import MAX_FILE_SIZE, OUTPUT_FILE_NAME
def test_cli_with_stdout_output() -> None:
"""Test CLI invocation w... | 0 | assert | numeric_literal | tests/test_cli.py | test_cli_with_stdout_output | 73 | null | |
coderamp-labs/gitingest | import pytest
from gitingest.utils.notebook import process_notebook
from tests.conftest import WriteNotebookFunc
def test_process_notebook_with_worksheets(write_notebook: WriteNotebookFunc) -> None:
"""Test a notebook containing the (as of IPEP-17 deprecated) ``worksheets`` key.
Given a notebook that uses th... | result_without | assert | variable | tests/test_notebook_utils.py | test_process_notebook_with_worksheets | 77 | null | |
coderamp-labs/gitingest | import re
from pathlib import Path
import pytest
from gitingest import ingest
REPO = "pallets/flask"
PATH_CASES = [
("tree", "/examples/celery"),
("blob", "/examples/celery/make_celery.py"),
("blob", "/.gitignore"),
]
REF_CASES = [
("Branch", "main"),
("Branch", "stable"),
("Tag", "3.0.3"),... | parsed_lines | assert | variable | tests/test_summary.py | test_ingest_summary | 67 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import pytest
from gitingest.config import MAX_FILE_SIZE
from gitingest.query_parser import parse_remote_repo
from gitingest.utils.query_parser_utils import KNOWN_GIT_HOSTS, _is_valid_git_commit_hash
_REPOS: list[tuple[str, str, str]] = [
("github.com", "fastapi", "fastapi"),
... | expected | assert | variable | tests/query_parser/test_git_host_agnostic.py | test_parse_query_without_host | 79 | null | |
coderamp-labs/gitingest | import shutil
import sys
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Generator
import pytest
from fastapi import status
from fastapi.testclient import TestClient
from pytest_mock import MockerFixture
from src.server.main import app
BASE_DIR = Path(__file__).resolve()... | "include" | assert | string_literal | tests/server/test_flow_integration.py | test_repository_with_patterns | 189 | null | |
coderamp-labs/gitingest | import shutil
import sys
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Generator
import pytest
from fastapi import status
from fastapi.testclient import TestClient
from pytest_mock import MockerFixture
from src.server.main import app
BASE_DIR = Path(__file__).resolve()... | status.HTTP_200_OK | assert | complex_expr | tests/server/test_flow_integration.py | test_large_repository | 108 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from inspect import signature
from pathlib import Path
import pytest
from click.testing import CliRunner, Result
from gitingest.__main__ import main
from gitingest.config import MAX_FILE_SIZE, OUTPUT_FILE_NAME
@pytest.mark.parametrize(
("cli_args", "expect_file"),
[
... | expect_file | assert | variable | tests/test_cli.py | test_cli_writes_file | 59 | null | |
coderamp-labs/gitingest | import shutil
import sys
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Generator
import pytest
from fastapi import status
from fastapi.testclient import TestClient
from pytest_mock import MockerFixture
from src.server.main import app
BASE_DIR = Path(__file__).resolve()... | "*.md" | assert | string_literal | tests/server/test_flow_integration.py | test_repository_with_patterns | 191 | null | |
coderamp-labs/gitingest | import re
from pathlib import Path
import pytest
from gitingest import ingest
REPO = "pallets/flask"
PATH_CASES = [
("tree", "/examples/celery"),
("blob", "/examples/celery/make_celery.py"),
("blob", "/.gitignore"),
]
REF_CASES = [
("Branch", "main"),
("Branch", "stable"),
("Tag", "3.0.3"),... | path | assert | variable | tests/test_summary.py | test_ingest_summary | 75 | null | |
coderamp-labs/gitingest | from gitingest.utils.ignore_patterns import DEFAULT_IGNORE_PATTERNS
from gitingest.utils.pattern_utils import _parse_patterns, process_patterns
def test_process_patterns_empty_patterns() -> None:
"""Test ``process_patterns`` with empty patterns.
Given empty ``include_patterns`` and ``exclude_patterns``:
W... | DEFAULT_IGNORE_PATTERNS | assert | variable | tests/test_pattern_utils.py | test_process_patterns_empty_patterns | 17 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import sys
from typing import TYPE_CHECKING
import pytest
from gitingest.clone import clone_repo
from gitingest.schemas import CloneConfig
from gitingest.utils.git_utils import check_repo_exists
from tests.conftest import DEMO_URL, LOCAL_REPO_PATH
pytestmark = pytest.mark.usefixtu... | "HEAD") | assert_* | string_literal | tests/test_clone.py | test_check_repo_exists | 117 | null | |
coderamp-labs/gitingest | from pathlib import Path
import pytest
from gitingest.entrypoint import ingest_async
from gitingest.utils.ignore_patterns import load_ignore_patterns
def repo_fixture(tmp_path: Path) -> Path:
"""Create a temporary repository structure.
The repository structure includes:
- A ``.gitignore`` that excludes ... | patterns | assert | variable | tests/test_gitignore_feature.py | test_load_gitignore_patterns | 44 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import sys
from typing import TYPE_CHECKING
import pytest
from gitingest.clone import clone_repo
from gitingest.schemas import CloneConfig
from gitingest.utils.git_utils import check_repo_exists
from tests.conftest import DEMO_URL, LOCAL_REPO_PATH
pytestmark = pytest.mark.usefixtu... | ValueError, match="Repository not found") | pytest.raises | complex_expr | tests/test_clone.py | test_clone_nonexistent_repository | 86 | null | |
coderamp-labs/gitingest | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Callable
import pytest
from gitingest.query_parser import parse_local_dir_path, parse_remote_repo
from gitingest.utils.query_parser_utils import _is_valid_git_commit_hash
from tests.conftest import DEMO_URL
URLS_HTTPS: lis... | "main" | assert | string_literal | tests/query_parser/test_query_parser.py | test_parse_url_with_subpaths | 124 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import sys
from typing import TYPE_CHECKING
import pytest
from gitingest.clone import clone_repo
from gitingest.schemas import CloneConfig
from gitingest.utils.git_utils import check_repo_exists
from tests.conftest import DEMO_URL, LOCAL_REPO_PATH
pytestmark = pytest.mark.usefixtu... | True | assert | bool_literal | tests/test_clone.py | test_check_repo_exists_with_auth_token | 222 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import base64
from typing import TYPE_CHECKING
import pytest
from gitingest.utils.exceptions import InvalidGitHubTokenError
from gitingest.utils.git_utils import create_git_auth_header, create_git_repo, is_github_host, validate_github_token
@pytest.mark.parametrize(
"token",
... | expected | assert | variable | tests/test_git_utils.py | test_create_git_auth_header | 118 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import base64
from typing import TYPE_CHECKING
import pytest
from gitingest.utils.exceptions import InvalidGitHubTokenError
from gitingest.utils.git_utils import create_git_auth_header, create_git_repo, is_github_host, validate_github_token
@pytest.mark.parametrize(
("local_pa... | local_path) | assert_* | variable | tests/test_git_utils.py | test_create_git_repo | 96 | null | |
coderamp-labs/gitingest | from __future__ import annotations
import base64
from typing import TYPE_CHECKING
import pytest
from gitingest.utils.exceptions import InvalidGitHubTokenError
from gitingest.utils.git_utils import create_git_auth_header, create_git_repo, is_github_host, validate_github_token
@pytest.mark.parametrize(
("local_pa... | mock_repo | assert | variable | tests/test_git_utils.py | test_create_git_repo | 97 | null | |
coderamp-labs/gitingest | import shutil
import sys
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Generator
import pytest
from fastapi import status
from fastapi.testclient import TestClient
from pytest_mock import MockerFixture
from src.server.main import app
BASE_DIR = Path(__file__).resolve()... | response_data | assert | variable | tests/server/test_flow_integration.py | test_remote_repository_analysis | 65 | null | |
temporal-community/temporal-ai-agent | import json
import os
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from temporalio.client import Client
from temporalio.testing import ActivityEnvironment
from activities.tool_activities import (
MCPServerDefinition,
ToolActivities,
dynamic_tool_activity,
)
from models.data_types im... | 123 | assert | numeric_literal | tests/test_tool_activities.py | test_convert_args_types | TestMCPIntegration | 466 | null |
temporal-community/temporal-ai-agent | import json
import os
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from temporalio.client import Client
from temporalio.testing import ActivityEnvironment
from activities.tool_activities import (
MCPServerDefinition,
ToolActivities,
dynamic_tool_activity,
)
from models.data_types im... | "system" | assert | string_literal | tests/test_tool_activities.py | test_agent_toolPlanner_success | TestToolActivities | 129 | null |
temporal-community/temporal-ai-agent | import json
import os
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from temporalio.client import Client
from temporalio.testing import ActivityEnvironment
from activities.tool_activities import (
MCPServerDefinition,
ToolActivities,
dynamic_tool_activity,
)
from models.data_types im... | True | assert | bool_literal | tests/test_tool_activities.py | test_convert_args_types | TestMCPIntegration | 468 | null |
temporal-community/temporal-ai-agent | import asyncio
import uuid
from collections import deque
from typing import Sequence
from unittest.mock import patch
import pytest
from temporalio import activity
from temporalio.client import Client
from temporalio.common import RawValue
from temporalio.testing import ActivityEnvironment
from temporalio.worker import... | server_def.name | assert | complex_expr | tests/test_mcp_integration.py | test_mcp_tool_execution_flow | 312 | null | |
temporal-community/temporal-ai-agent | import uuid
from temporalio import activity
from temporalio.client import Client
from temporalio.worker import Worker
from models.data_types import (
AgentGoalWorkflowParams,
CombinedInput,
EnvLookupInput,
EnvLookupOutput,
ToolPromptInput,
ValidationInput,
ValidationResult,
)
from workflow... | None | assert | none_literal | tests/test_agent_goal_workflow.py | test_workflow_initialization | TestAgentGoalWorkflow | 48 | null |
temporal-community/temporal-ai-agent | import json
import os
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from temporalio.client import Client
from temporalio.testing import ActivityEnvironment
from activities.tool_activities import (
MCPServerDefinition,
ToolActivities,
dynamic_tool_activity,
)
from models.data_types im... | "user" | assert | string_literal | tests/test_tool_activities.py | test_agent_toolPlanner_success | TestToolActivities | 130 | null |
temporal-community/temporal-ai-agent | import uuid
from temporalio import activity
from temporalio.client import Client
from temporalio.worker import Worker
from models.data_types import (
AgentGoalWorkflowParams,
CombinedInput,
EnvLookupInput,
EnvLookupOutput,
ToolPromptInput,
ValidationInput,
ValidationResult,
)
from workflow... | 0 | assert | numeric_literal | tests/test_agent_goal_workflow.py | test_user_prompt_signal | TestAgentGoalWorkflow | 125 | null |
temporal-community/temporal-ai-agent | import json
import os
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from temporalio.client import Client
from temporalio.testing import ActivityEnvironment
from activities.tool_activities import (
MCPServerDefinition,
ToolActivities,
dynamic_tool_activity,
)
from models.data_types im... | 123.45 | assert | numeric_literal | tests/test_tool_activities.py | test_convert_args_types | TestMCPIntegration | 467 | null |
temporal-community/temporal-ai-agent | import asyncio
import uuid
from collections import deque
from typing import Sequence
from unittest.mock import patch
import pytest
from temporalio import activity
from temporalio.client import Client
from temporalio.common import RawValue
from temporalio.testing import ActivityEnvironment
from temporalio.worker import... | False | assert | bool_literal | tests/test_mcp_integration.py | test_convert_args_types_basic | 64 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.