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
pimutils/khal
import datetime as dt import pytest import pytz from freezegun import freeze_time from hypothesis import event, given from hypothesis.strategies import datetimes from icalendar import Parameters, vCalAddress, vRecur, vText from packaging import version from khal.controllers import human_formatter from khal.khalendar....
event2
assert
variable
tests/event_test.py
test_sort_date_vs_datetime
624
null
pimutils/khal
import os from time import sleep from khal.khalendar import vdir def test_etag(tmpdir, sleep_time): fpath = os.path.join(str(tmpdir), 'foo') file_ = open(fpath, 'w') file_.write('foo') file_.close() old_etag = vdir.get_etag_from_file(fpath) sleep(sleep_time) file_ = open(fpath, 'w') ...
new_etag
assert
variable
tests/vdir_test.py
test_etag
44
null
pimutils/khal
import datetime as dt from operator import itemgetter import icalendar import pytest from khal.khalendar import backend from khal.khalendar.exceptions import OutdatedDbVersionError, UpdateFailed from .utils import BERLIN, LOCALE_BERLIN, _get_text calname = 'home' def test_event_rrule_recurrence_id_update_with_excl...
5
assert
numeric_literal
tests/backend_test.py
test_event_rrule_recurrence_id_update_with_exclude
131
null
pimutils/khal
import datetime as dt from click import style from freezegun import freeze_time from khal import utils def test_last_sgr(): assert utils.find_last_sgr(weekheader) ==
(0, 4, '\x1b[1m')
assert
collection
tests/utils_test.py
test_last_sgr
34
null
pimutils/khal
import datetime as dt import pytest import pytz from freezegun import freeze_time from hypothesis import event, given from hypothesis.strategies import datetimes from icalendar import Parameters, vCalAddress, vRecur, vText from packaging import version from khal.controllers import human_formatter from khal.khalendar....
False
assert
bool_literal
tests/event_test.py
test_raw_dt
62
null
pimutils/khal
from khal.terminal import colored, merge_columns def test_colored(): assert colored('test', 'light cyan') == '\33[1;36mtest\x1b[0m' assert colored('täst', 'white') == '\33[37mtäst\x1b[0m' assert colored('täst', 'white', 'dark green') == '\x1b[37m\x1b[42mtäst\x1b[0m' assert colored('täst', 'light magent...
'\x1b[95m\x1b[42mtäst\x1b[0m'
assert
string_literal
tests/terminal_test.py
test_colored
9
null
pimutils/khal
import datetime as dt import icalendar import pytz from khal import icalendar as icalendar_helpers from khal import utils from .utils import _get_text, _get_vevent_file BERLIN = pytz.timezone('Europe/Berlin') BOGOTA = pytz.timezone('America/Bogota') event_dt = """BEGIN:VCALENDAR CALSCALE:GREGORIAN VERSION:2.0 BEGI...
7
assert
numeric_literal
tests/khalendar_utils_test.py
test_expand_rrule_notz_until_z
TestExpandNoRR
469
null
pimutils/khal
import datetime as dt from collections import OrderedDict import pytest from freezegun import freeze_time from khal.exceptions import DateTimeParseError, FatalError from khal.icalendar import new_vevent from khal.parse_datetime import ( construct_daynames, eventinfofstr, guessdatetimefstr, guessrangef...
'5d 21h 9m 57s'
assert
string_literal
tests/parse_datetime_test.py
test_multi
TestTimeDelta2Str
88
null
pimutils/khal
import datetime as dt import icalendar import pytz from khal import icalendar as icalendar_helpers from khal import utils from .utils import _get_text, _get_vevent_file BERLIN = pytz.timezone('Europe/Berlin') BOGOTA = pytz.timezone('America/Bogota') event_dt = """BEGIN:VCALENDAR CALSCALE:GREGORIAN VERSION:2.0 BEGI...
6
assert
numeric_literal
tests/khalendar_utils_test.py
test_until_d_notz
TestSpecial
605
null
pimutils/khal
import datetime as dt import random import textwrap import icalendar from freezegun import freeze_time from khal.icalendar import new_vevent, split_ics from .utils import LOCALE_BERLIN, _get_text, _replace_uid, normalize_component def _get_TZIDs(lines): """from a list of strings, get all unique strings that sta...
sorted(part0)
assert
func_call
tests/icalendar_test.py
test_split_ics
66
null
pimutils/khal
import datetime as dt import pytz from packaging import version from khal.khalendar.event import create_timezone berlin = pytz.timezone('Europe/Berlin') bogota = pytz.timezone('America/Bogota') atime = dt.datetime(2014, 10, 28, 10, 10) btime = dt.datetime(2016, 10, 28, 10, 10) def test_berlin(): vberlin_std = ...
vberlin
assert
variable
tests/vtimezone_test.py
test_berlin
35
null
pimutils/khal
import datetime as dt import locale import platform import unicodedata import pytest from khal.calendar_display import ( get_calendar_color, get_color_list, getweeknumber, str_week, vertical_month, ) today = dt.date.today() yesterday = today - dt.timedelta(days=1) tomorrow = today + dt.timedelta(...
'light blue'
assert
string_literal
tests/cal_display_test.py
test_get_calendar_color
62
null
pimutils/khal
import datetime as dt import random import textwrap import icalendar from freezegun import freeze_time from khal.icalendar import new_vevent, split_ics from .utils import LOCALE_BERLIN, _get_text, _replace_uid, normalize_component def _get_TZIDs(lines): """from a list of strings, get all unique strings that sta...
normalize_component(textwrap.dedent(""" BEGIN:VEVENT DTSTART;TZID=Oyrope/Berlin:20140409T093000 END:VEVENT """))
assert
func_call
tests/icalendar_test.py
test_normalize_component
19
null
pimutils/khal
import datetime as dt from textwrap import dedent import pytest from freezegun import freeze_time from khal import exceptions from khal.controllers import import_ics, khal_list, start_end_from_daterange from khal.khalendar.vdir import Item from . import utils from .utils import _get_text today = dt.date.today() yes...
exceptions.FatalError)
pytest.raises
complex_expr
tests/controller_test.py
test_agenda_fail
TestGetAgenda
73
null
pimutils/khal
import datetime as dt import os.path import pytest from tzlocal import get_localzone as _get_localzone from khal.settings import get_config from khal.settings.exceptions import CannotParseConfigFileError, InvalidSettingsError from khal.settings.utils import ( config_checks, get_all_vdirs, get_color_from_v...
{vdir[len(path):] for vdir in get_all_vdirs(path + '/**/*/')}
assert
collection
tests/settings_test.py
test_discover
191
null
pimutils/khal
import datetime as dt import logging import os from textwrap import dedent from time import sleep import pytest from freezegun import freeze_time import khal.khalendar.exceptions import khal.utils from khal import icalendar as icalendar_helpers from khal.controllers import human_formatter from khal.khalendar import C...
1
assert
numeric_literal
tests/khalendar_test.py
test_event_different_timezones
432
null
pimutils/khal
import datetime as dt import icalendar from khal.ui.editor import RecurrenceEditor, StartEndEditor from tests.utils import BERLIN, LOCALE_BERLIN from .canvas_render import CanvasTranslator CONF = {'locale': LOCALE_BERLIN, 'keybindings': {}, 'view': {'monthdisplay': 'firstday'}} START = BERLIN.localize(dt.datetime(...
dt.date(2015, 4, 26)
assert
func_call
tests/ui/test_editor.py
test_popup
39
null
pimutils/khal
import datetime as dt from click import style from freezegun import freeze_time from khal import utils def test_relative_timedelta_str(): with freeze_time('2016-9-19'): assert utils.relative_timedelta_str(dt.date(2016, 9, 24)) == '5 days from now' assert utils.relative_timedelta_str(dt.date(2016...
'~1 week from now'
assert
string_literal
tests/utils_test.py
test_relative_timedelta_str
13
null
pimutils/khal
import datetime as dt import icalendar import pytz from khal import icalendar as icalendar_helpers from khal import utils from .utils import _get_text, _get_vevent_file BERLIN = pytz.timezone('Europe/Berlin') BOGOTA = pytz.timezone('America/Bogota') event_dt = """BEGIN:VCALENDAR CALSCALE:GREGORIAN VERSION:2.0 BEGI...
3
assert
numeric_literal
tests/khalendar_utils_test.py
test_expand_dtr_exdatez
TestExpandNoRR
443
null
pimutils/khal
import datetime as dt from freezegun import freeze_time from khal.ui import DayWalker, DListBox, StaticDayWalker from tests.utils import LOCALE_BERLIN from .canvas_render import CanvasTranslator CONF = {'locale': LOCALE_BERLIN, 'keybindings': {}, 'view': {'monthdisplay': 'firstday'}, 'default': {'ti...
"""\x1b[34mToday (Wednesday, 07.06.2017)\x1b[0m \x1b[32mTomorrow (Thursday, 08.06.2017)\x1b[0m \x1b[32mFriday, 09.06.2017 (2 days from now)\x1b[0m \x1b[32mSaturday, 10.06.2017 (3 days from now)\x1b[0m \x1b[32mSunday, 11.06.2017 (4 days from now)\x1b[0m \x1b[32mMonday, 12.06.2017 (5 days from now)\x1b[0m """
assert
string_literal
tests/ui/test_walker.py
test_daywalker
36
null
pimutils/khal
import datetime as dt import os.path import pytest from tzlocal import get_localzone as _get_localzone from khal.settings import get_config from khal.settings.exceptions import CannotParseConfigFileError, InvalidSettingsError from khal.settings.utils import ( config_checks, get_all_vdirs, get_color_from_v...
VdtValueError)
pytest.raises
variable
tests/settings_test.py
test_is_color
312
null
pimutils/khal
import datetime as dt import locale import platform import unicodedata import pytest from khal.calendar_display import ( get_calendar_color, get_color_list, getweeknumber, str_week, vertical_month, ) today = dt.date.today() yesterday = today - dt.timedelta(days=1) tomorrow = today + dt.timedelta(...
example_de_netbsd
assert
variable
tests/cal_display_test.py
test_vertical_month_unicode
355
null
pimutils/khal
import datetime as dt from collections import OrderedDict import pytest from freezegun import freeze_time from khal.exceptions import DateTimeParseError, FatalError from khal.icalendar import new_vevent from khal.parse_datetime import ( construct_daynames, eventinfofstr, guessdatetimefstr, guessrangef...
vevent_expected
assert
variable
tests/parse_datetime_test.py
test_construct_event_format_de
423
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.schemas.api.search import SearchHit, SearchRequest, SearchResponse def test_search_request_defaults(): """Test SearchRequest with default values.""" request = SearchRequest(query="test query") assert request.query ==
"test query"
assert
string_literal
tests/unit/schemas/test_search.py
test_search_request_defaults
21
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.services.agents.models import ( GuardrailScoring, GradeDocuments, SourceItem, ToolArtefact, RoutingDecision, GradingResult, ReasoningStep, ) class TestGradingResult: def test_valid_grading_result(self): """Test creati...
0.87
assert
numeric_literal
tests/unit/services/agents/test_models.py
test_valid_grading_result
TestGradingResult
177
null
jamwithai/production-agentic-rag-course
import pytest async def test_search_endpoint_with_latest_papers(client): response = await client.post( "/api/v1/hybrid-search/", json={"query": "machine learning", "size": 3, "latest_papers": True, "use_hybrid": False} ) assert response.status_code == 200 data = response.json() assert da...
"machine learning"
assert
string_literal
tests/api/routers/test_hybrid_search.py
test_search_endpoint_with_latest_papers
29
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.services.agents.models import ( GuardrailScoring, GradeDocuments, SourceItem, ToolArtefact, RoutingDecision, GradingResult, ReasoningStep, ) class TestGradeDocuments: def test_default_reasoning(self): """Test default ...
""
assert
string_literal
tests/unit/services/agents/test_models.py
test_default_reasoning
TestGradeDocuments
60
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.services.agents.models import ( GuardrailScoring, GradeDocuments, SourceItem, ToolArtefact, RoutingDecision, GradingResult, ReasoningStep, ) class TestSourceItem: def test_valid_source_item(self): """Test creating val...
0.95
assert
numeric_literal
tests/unit/services/agents/test_models.py
test_valid_source_item
TestSourceItem
84
null
jamwithai/production-agentic-rag-course
import pytest async def test_search_endpoint_pagination(client): response = await client.post("/api/v1/hybrid-search/", json={"query": "artificial intelligence", "size": 5, "from": 10}) assert response.status_code == 200 data = response.json() assert data["query"] ==
"artificial intelligence"
assert
string_literal
tests/api/routers/test_hybrid_search.py
test_search_endpoint_pagination
61
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import MagicMock, mock_open, patch import pytest from src.exceptions import PDFParsingException, PDFValidationError from src.schemas.pdf_parser.models import PaperSection, ParserType, PdfContent from src.services.pdf_parser.docling import DoclingParser from src.services.pdf_...
str(exc_info.value)
assert
func_call
tests/unit/services/test_pdf_parser.py
test_validate_pdf_empty_file
TestDoclingParser
57
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import MagicMock, mock_open, patch import pytest from src.exceptions import PDFParsingException, PDFValidationError from src.schemas.pdf_parser.models import PaperSection, ParserType, PdfContent from src.services.pdf_parser.docling import DoclingParser from src.services.pdf_...
False
assert
bool_literal
tests/unit/services/test_pdf_parser.py
test_docling_parser_initialization
TestDoclingParser
45
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock from langchain_core.documents import Document from src.services.agents.tools import create_retriever_tool @pytest.mark.asyncio async def test_create_retriever_tool_basic(mock_opensearch_client, mock_jina_embeddings_client): """Test basic retriever tool creation an...
"1706.03762"
assert
string_literal
tests/unit/services/agents/test_tools.py
test_create_retriever_tool_basic
33
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from src.services.agents.agentic_rag import AgenticRAGService from src.services.agents.config import GraphConfig from src.services.agents.models import GuardrailScoring class TestAgenticRAG...
"llama3.2:1b"
assert
string_literal
tests/unit/services/agents/test_agentic_rag.py
test_graph_config_values
TestAgenticRAGServiceInitialization
45
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
["cs.AI"]
assert
collection
tests/unit/services/test_arxiv_client.py
test_fetch_papers_success
TestArxivClient
72
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from langgraph.runtime import Runtime from src.services.agents.nodes import ( ainvoke_retrieve_step, ainvoke_grade_documents_step, ainvoke_rewrite_query_step, ainvoke_generat...
"continue"
assert
string_literal
tests/unit/services/agents/test_nodes.py
test_continue_after_guardrail_pass
TestGuardrailNode
36
null
jamwithai/production-agentic-rag-course
import pytest async def test_search_endpoint_basic(client): response = await client.post("/api/v1/hybrid-search/", json={"query": "neural networks", "size": 5}) assert response.status_code == 200 data = response.json() assert "query" in
data
assert
variable
tests/api/routers/test_hybrid_search.py
test_search_endpoint_basic
10
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.services.agents.models import ( GuardrailScoring, GradeDocuments, SourceItem, ToolArtefact, RoutingDecision, GradingResult, ReasoningStep, ) class TestRoutingDecision: def test_valid_routing_decisions(self): """Test a...
route
assert
variable
tests/unit/services/agents/test_models.py
test_valid_routing_decisions
TestRoutingDecision
150
null
jamwithai/production-agentic-rag-course
import pytest async def test_ask_endpoint_validation_errors(client): response = await client.post("/api/v1/ask", json={"query": "", "model": "llama3.2:3b"}) assert response.status_code ==
422
assert
numeric_literal
tests/api/routers/test_ask.py
test_ask_endpoint_validation_errors
45
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
ArxivAPIException)
pytest.raises
variable
tests/unit/services/test_arxiv_client.py
test_fetch_papers_http_error
TestArxivClient
114
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from src.services.agents.agentic_rag import AgenticRAGService from src.services.agents.config import GraphConfig from src.services.agents.models import GuardrailScoring class TestAgenticRAG...
2
assert
numeric_literal
tests/unit/services/agents/test_agentic_rag.py
test_graph_config_values
TestAgenticRAGServiceInitialization
48
null
jamwithai/production-agentic-rag-course
import asyncio import time from pathlib import Path from unittest.mock import AsyncMock, MagicMock, patch import pytest from src.exceptions import MetadataFetchingException, PipelineException from src.schemas.arxiv.paper import ArxivPaper from src.schemas.pdf_parser.models import ParserType, PdfContent from src.servic...
0
assert
numeric_literal
tests/unit/services/test_metadata_fetcher.py
test_empty_papers_list
TestMetadataFetcher
87
null
jamwithai/production-agentic-rag-course
import pytest from fastapi.testclient import TestClient from unittest.mock import AsyncMock, Mock from src.main import app from src.services.agents.agentic_rag import AgenticRAGService from src import dependencies def mock_agentic_rag_service(): """Mock AgenticRAGService for API testing.""" service = Mock(spe...
4
assert
numeric_literal
tests/api/routers/test_agentic_ask.py
test_ask_agentic_reasoning_steps
TestAgenticAskEndpoint
166
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import MagicMock, mock_open, patch import pytest from src.exceptions import PDFParsingException, PDFValidationError from src.schemas.pdf_parser.models import PaperSection, ParserType, PdfContent from src.services.pdf_parser.docling import DoclingParser from src.services.pdf_...
valid_pdf_path)
assert_*
variable
tests/unit/services/test_pdf_parser.py
test_parse_pdf_success
TestPDFParserService
120
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
15
assert
numeric_literal
tests/unit/services/test_arxiv_client.py
test_factory_creates_client
TestArxivClient
53
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
ArxivParseError)
pytest.raises
variable
tests/unit/services/test_arxiv_client.py
test_parse_response_invalid_xml
TestArxivClient
157
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from src.services.agents.agentic_rag import AgenticRAGService from src.services.agents.config import GraphConfig from src.services.agents.models import GuardrailScoring class TestAgenticRAG...
None
assert
none_literal
tests/unit/services/agents/test_agentic_rag.py
test_service_initialization
TestAgenticRAGServiceInitialization
37
null
jamwithai/production-agentic-rag-course
import pytest from src.services.opensearch.query_builder import QueryBuilder def test_query_builder_basic_query(): builder = QueryBuilder(query="machine learning", size=5) query = builder.build() assert query["size"] ==
5
assert
numeric_literal
tests/unit/services/test_opensearch_query_builder.py
test_query_builder_basic_query
10
null
jamwithai/production-agentic-rag-course
import os import pytest from src.config import Settings def test_settings_postgres_defaults(): """Test PostgreSQL default configuration.""" settings = Settings() assert "postgresql://" in settings.postgres_database_url assert settings.postgres_echo_sql is False assert settings.postgres_pool_size ...
0
assert
numeric_literal
tests/unit/test_config.py
test_settings_postgres_defaults
24
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
0.1
assert
numeric_literal
tests/unit/services/test_arxiv_client.py
test_rate_limiting
TestArxivClient
190
null
jamwithai/production-agentic-rag-course
import os import pytest from src.config import Settings def test_settings_initialization(): """Test settings can be initialized.""" settings = Settings() assert settings.app_version == "0.1.0" assert settings.debug is True assert settings.environment ==
"development"
assert
string_literal
tests/unit/test_config.py
test_settings_initialization
13
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from langgraph.runtime import Runtime from src.services.agents.nodes import ( ainvoke_retrieve_step, ainvoke_grade_documents_step, ainvoke_rewrite_query_step, ainvoke_generat...
"Second query"
assert
string_literal
tests/unit/services/agents/test_nodes.py
test_get_latest_query_with_multiple_human_messages
TestNodeUtils
237
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from src.services.agents.agentic_rag import AgenticRAGService from src.services.agents.config import GraphConfig from src.services.agents.models import GuardrailScoring class TestAgenticRAG...
3
assert
numeric_literal
tests/unit/services/agents/test_agentic_rag.py
test_graph_config_values
TestAgenticRAGServiceInitialization
46
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.schemas.api.search import SearchHit, SearchRequest, SearchResponse def test_search_request_validation_errors(): """Test SearchRequest validation errors.""" # Empty query should fail with pytest.raises(
ValidationError)
pytest.raises
variable
tests/unit/schemas/test_search.py
test_search_request_validation_errors
32
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
str(exc_info.value)
assert
func_call
tests/unit/services/test_arxiv_client.py
test_parse_response_invalid_xml
TestArxivClient
160
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock from langchain_core.documents import Document from src.services.agents.tools import create_retriever_tool @pytest.mark.asyncio async def test_create_retriever_tool_basic(mock_opensearch_client, mock_jina_embeddings_client): """Test basic retriever tool creation an...
0.95
assert
numeric_literal
tests/unit/services/agents/test_tools.py
test_create_retriever_tool_basic
35
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.services.agents.models import ( GuardrailScoring, GradeDocuments, SourceItem, ToolArtefact, RoutingDecision, GradingResult, ReasoningStep, ) class TestSourceItem: def test_default_values(self): """Test default field v...
[]
assert
collection
tests/unit/services/agents/test_models.py
test_default_values
TestSourceItem
93
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
"Test Paper Title"
assert
string_literal
tests/unit/services/test_arxiv_client.py
test_fetch_papers_success
TestArxivClient
69
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from langgraph.runtime import Runtime from src.services.agents.nodes import ( ainvoke_retrieve_step, ainvoke_grade_documents_step, ainvoke_rewrite_query_step, ainvoke_generat...
0
assert
numeric_literal
tests/unit/services/agents/test_nodes.py
test_retrieve_creates_tool_call
TestRetrieveNode
72
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.services.agents.models import ( GuardrailScoring, GradeDocuments, SourceItem, ToolArtefact, RoutingDecision, GradingResult, ReasoningStep, ) class TestToolArtefact: def test_default_metadata(self): """Test default emp...
{}
assert
collection
tests/unit/services/agents/test_models.py
test_default_metadata
TestToolArtefact
138
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from src.services.agents.agentic_rag import AgenticRAGService from src.services.agents.config import GraphConfig from src.services.agents.models import GuardrailScoring class TestAgenticRAG...
0
assert
numeric_literal
tests/unit/services/agents/test_agentic_rag.py
test_get_graph_mermaid
TestAgenticRAGGraphVisualization
101
null
jamwithai/production-agentic-rag-course
import os import pytest from src.config import Settings def test_settings_initialization(): """Test settings can be initialized.""" settings = Settings() assert settings.app_version == "0.1.0" assert settings.debug is
True
assert
bool_literal
tests/unit/test_config.py
test_settings_initialization
12
null
jamwithai/production-agentic-rag-course
from unittest.mock import MagicMock, patch from src.config import TelegramSettings from src.services.telegram.bot import TelegramBot from src.services.telegram.factory import make_telegram_service class TestTelegramSettings: def test_custom_settings(self): """Test custom settings.""" settings = T...
True
assert
bool_literal
tests/unit/services/test_telegram.py
test_custom_settings
TestTelegramSettings
39
null
jamwithai/production-agentic-rag-course
import pytest from fastapi.testclient import TestClient from unittest.mock import AsyncMock, Mock from src.main import app from src.services.agents.agentic_rag import AgenticRAGService from src import dependencies def mock_agentic_rag_service(): """Mock AgenticRAGService for API testing.""" service = Mock(spe...
data
assert
variable
tests/api/routers/test_agentic_ask.py
test_ask_agentic_success
TestAgenticAskEndpoint
63
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
call_args
assert
variable
tests/unit/services/test_arxiv_client.py
test_fetch_papers_with_date_filters
TestArxivClient
89
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from src.services.agents.agentic_rag import AgenticRAGService from src.services.agents.config import GraphConfig from src.services.agents.models import GuardrailScoring class TestAgenticRAG...
Exception, match="Graph execution failed")
pytest.raises
complex_expr
tests/unit/services/agents/test_agentic_rag.py
test_ask_with_graph_execution_error
TestAgenticRAGErrorHandling
114
null
jamwithai/production-agentic-rag-course
import pytest async def test_ask_endpoint_with_hybrid_search(client): response = await client.post( "/api/v1/ask", json={"query": "neural networks", "model": "llama3.2:3b", "use_hybrid": True, "top_k": 5} ) assert response.status_code in [200, 500, 503] if response.status_code == 200: ...
"neural networks"
assert
string_literal
tests/api/routers/test_ask.py
test_ask_endpoint_with_hybrid_search
32
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from langgraph.runtime import Runtime from src.services.agents.nodes import ( ainvoke_retrieve_step, ainvoke_grade_documents_step, ainvoke_rewrite_query_step, ainvoke_generat...
1
assert
numeric_literal
tests/unit/services/agents/test_nodes.py
test_retrieve_creates_tool_call
TestRetrieveNode
69
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from langgraph.runtime import Runtime from src.services.agents.nodes import ( ainvoke_retrieve_step, ainvoke_grade_documents_step, ainvoke_rewrite_query_step, ainvoke_generat...
""
assert
string_literal
tests/unit/services/agents/test_nodes.py
test_get_latest_context_no_tool_messages
TestNodeUtils
252
null
jamwithai/production-agentic-rag-course
import pytest async def test_ask_endpoint_basic(client): response = await client.post("/api/v1/ask", json={"query": "What is machine learning?", "model": "llama3.2:3b"}) assert response.status_code in [200, 500, 503] if response.status_code == 200: data = response.json() assert "query" ...
data
assert
variable
tests/api/routers/test_ask.py
test_ask_endpoint_basic
12
null
jamwithai/production-agentic-rag-course
import os import pytest from src.config import Settings def test_settings_postgres_defaults(): """Test PostgreSQL default configuration.""" settings = Settings() assert "postgresql://" in settings.postgres_database_url assert settings.postgres_echo_sql is
False
assert
bool_literal
tests/unit/test_config.py
test_settings_postgres_defaults
22
null
jamwithai/production-agentic-rag-course
import pytest async def test_health_check(client): response = await client.get("/api/v1/health") assert response.status_code ==
200
assert
numeric_literal
tests/api/routers/test_ping.py
test_health_check
6
null
jamwithai/production-agentic-rag-course
import pytest async def test_stream_endpoint_basic(client): response = await client.post("/api/v1/stream", json={"query": "What is deep learning?", "model": "llama3.2:3b"}) assert response.status_code in [200, 500, 503] if response.status_code == 200: assert "text/plain" in
response.headers.get("content-type", "")
assert
func_call
tests/api/routers/test_ask.py
test_stream_endpoint_basic
60
null
jamwithai/production-agentic-rag-course
import pytest from src.services.opensearch.query_builder import QueryBuilder def test_query_builder_latest_papers_sorting(): builder = QueryBuilder(query="neural networks", latest_papers=True) query = builder.build() assert "sort" in query sort_config = query["sort"] assert len(sort_config) ==
2
assert
numeric_literal
tests/unit/services/test_opensearch_query_builder.py
test_query_builder_latest_papers_sorting
44
null
jamwithai/production-agentic-rag-course
from unittest.mock import MagicMock, patch from src.config import TelegramSettings from src.services.telegram.bot import TelegramBot from src.services.telegram.factory import make_telegram_service class TestTelegramSettings: def test_default_settings(self): """Test default settings.""" # Explicit...
False
assert
bool_literal
tests/unit/services/test_telegram.py
test_default_settings
TestTelegramSettings
33
null
jamwithai/production-agentic-rag-course
import pytest from src.services.opensearch.query_builder import QueryBuilder def test_query_builder_basic_query(): builder = QueryBuilder(query="machine learning", size=5) query = builder.build() assert query["size"] == 5 assert query["from"] == 0 assert query["track_total_hits"] is True boo...
1
assert
numeric_literal
tests/unit/services/test_opensearch_query_builder.py
test_query_builder_basic_query
15
null
jamwithai/production-agentic-rag-course
from unittest.mock import MagicMock, patch from src.config import TelegramSettings from src.services.telegram.bot import TelegramBot from src.services.telegram.factory import make_telegram_service class TestTelegramBot: def test_bot_creation(self): """Test creating bot instance.""" bot = Telegram...
None
assert
none_literal
tests/unit/services/test_telegram.py
test_bot_creation
TestTelegramBot
21
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import MagicMock, mock_open, patch import pytest from src.exceptions import PDFParsingException, PDFValidationError from src.schemas.pdf_parser.models import PaperSection, ParserType, PdfContent from src.services.pdf_parser.docling import DoclingParser from src.services.pdf_...
PDFParsingException)
pytest.raises
variable
tests/unit/services/test_pdf_parser.py
test_parse_pdf_no_result
TestPDFParserService
128
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
None
assert
none_literal
tests/unit/services/test_arxiv_client.py
test_rate_limiting
TestArxivClient
191
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.schemas.api.search import SearchHit, SearchRequest, SearchResponse def test_search_request_valid(): """Test valid SearchRequest creation.""" request = SearchRequest(query="neural networks", size=10, latest_papers=True, categories=["cs.AI", "cs.LG"]) ...
10
assert
numeric_literal
tests/unit/schemas/test_search.py
test_search_request_valid
11
null
jamwithai/production-agentic-rag-course
import pytest from fastapi.testclient import TestClient from unittest.mock import AsyncMock, Mock from src.main import app from src.services.agents.agentic_rag import AgenticRAGService from src import dependencies def mock_agentic_rag_service(): """Mock AgenticRAGService for API testing.""" service = Mock(spe...
500
assert
numeric_literal
tests/api/routers/test_agentic_ask.py
test_ask_agentic_service_error
TestAgenticAskEndpoint
118
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import MagicMock, mock_open, patch import pytest from src.exceptions import PDFParsingException, PDFValidationError from src.schemas.pdf_parser.models import PaperSection, ParserType, PdfContent from src.services.pdf_parser.docling import DoclingParser from src.services.pdf_...
20
assert
numeric_literal
tests/unit/services/test_pdf_parser.py
test_docling_parser_initialization
TestDoclingParser
43
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import MagicMock, mock_open, patch import pytest from src.exceptions import PDFParsingException, PDFValidationError from src.schemas.pdf_parser.models import PaperSection, ParserType, PdfContent from src.services.pdf_parser.docling import DoclingParser from src.services.pdf_...
mock_content
assert
variable
tests/unit/services/test_pdf_parser.py
test_parse_pdf_success
TestPDFParserService
119
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock from langchain_core.documents import Document from src.services.agents.tools import create_retriever_tool @pytest.mark.asyncio async def test_create_retriever_tool_basic(mock_opensearch_client, mock_jina_embeddings_client): """Test basic retriever tool creation an...
True
assert
bool_literal
tests/unit/services/agents/test_tools.py
test_create_retriever_tool_basic
45
null
jamwithai/production-agentic-rag-course
import pytest from src.services.opensearch.query_builder import QueryBuilder def test_query_builder_source_fields(): builder = QueryBuilder(query="test query") query = builder.build() source_fields = query["_source"] expected_fields = ["arxiv_id", "title", "authors", "abstract", "categories", "publis...
source_fields
assert
variable
tests/unit/services/test_opensearch_query_builder.py
test_query_builder_source_fields
94
null
jamwithai/production-agentic-rag-course
import pytest from src.services.opensearch.query_builder import QueryBuilder def test_query_builder_basic_query(): builder = QueryBuilder(query="machine learning", size=5) query = builder.build() assert query["size"] == 5 assert query["from"] == 0 assert query["track_total_hits"] is
True
assert
bool_literal
tests/unit/services/test_opensearch_query_builder.py
test_query_builder_basic_query
12
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock from langchain_core.documents import Document from src.services.agents.tools import create_retriever_tool @pytest.mark.asyncio async def test_retriever_tool_empty_results(mock_opensearch_client, mock_jina_embeddings_client): """Test retriever tool with no results....
0
assert
numeric_literal
tests/unit/services/agents/test_tools.py
test_retriever_tool_empty_results
62
null
jamwithai/production-agentic-rag-course
import pytest async def test_health_check(client): response = await client.get("/api/v1/health") assert response.status_code == 200 data = response.json() assert "status" in
data
assert
variable
tests/api/routers/test_ping.py
test_health_check
8
null
jamwithai/production-agentic-rag-course
from unittest.mock import MagicMock, patch from src.config import TelegramSettings from src.services.telegram.bot import TelegramBot from src.services.telegram.factory import make_telegram_service class TestTelegramBot: def test_bot_creation(self): """Test creating bot instance.""" bot = Telegram...
"test_token"
assert
string_literal
tests/unit/services/test_telegram.py
test_bot_creation
TestTelegramBot
20
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.services.agents.models import ( GuardrailScoring, GradeDocuments, SourceItem, ToolArtefact, RoutingDecision, GradingResult, ReasoningStep, ) class TestGradeDocuments: def test_valid_yes_grade(self): """Test creating v...
"yes"
assert
string_literal
tests/unit/services/agents/test_models.py
test_valid_yes_grade
TestGradeDocuments
48
null
jamwithai/production-agentic-rag-course
import pytest from fastapi.testclient import TestClient from unittest.mock import AsyncMock, Mock from src.main import app from src.services.agents.agentic_rag import AgenticRAGService from src import dependencies def mock_agentic_rag_service(): """Mock AgenticRAGService for API testing.""" service = Mock(spe...
200
assert
numeric_literal
tests/api/routers/test_agentic_ask.py
test_ask_agentic_success
TestAgenticAskEndpoint
59
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import MagicMock, mock_open, patch import pytest from src.exceptions import PDFParsingException, PDFValidationError from src.schemas.pdf_parser.models import PaperSection, ParserType, PdfContent from src.services.pdf_parser.docling import DoclingParser from src.services.pdf_...
service2
assert
variable
tests/unit/services/test_pdf_parser.py
test_factory_caching
TestPDFParserService
155
null
jamwithai/production-agentic-rag-course
import pytest from fastapi.testclient import TestClient from unittest.mock import AsyncMock, Mock from src.main import app from src.services.agents.agentic_rag import AgenticRAGService from src import dependencies def mock_agentic_rag_service(): """Mock AgenticRAGService for API testing.""" service = Mock(spe...
0
assert
numeric_literal
tests/api/routers/test_agentic_ask.py
test_ask_agentic_success
TestAgenticAskEndpoint
74
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.services.agents.models import ( GuardrailScoring, GradeDocuments, SourceItem, ToolArtefact, RoutingDecision, GradingResult, ReasoningStep, ) class TestToolArtefact: def test_valid_tool_artefact(self): """Test creating...
3
assert
numeric_literal
tests/unit/services/agents/test_models.py
test_valid_tool_artefact
TestToolArtefact
129
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
["Test Author"]
assert
collection
tests/unit/services/test_arxiv_client.py
test_fetch_papers_success
TestArxivClient
71
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from langgraph.runtime import Runtime from src.services.agents.nodes import ( ainvoke_retrieve_step, ainvoke_grade_documents_step, ainvoke_rewrite_query_step, ainvoke_generat...
"out_of_scope"
assert
string_literal
tests/unit/services/agents/test_nodes.py
test_continue_after_guardrail_fail
TestGuardrailNode
50
null
jamwithai/production-agentic-rag-course
import pytest async def test_ask_endpoint_with_hybrid_search(client): response = await client.post( "/api/v1/ask", json={"query": "neural networks", "model": "llama3.2:3b", "use_hybrid": True, "top_k": 5} ) assert response.status_code in
[200, 500, 503]
assert
collection
tests/api/routers/test_ask.py
test_ask_endpoint_with_hybrid_search
28
null
jamwithai/production-agentic-rag-course
import pytest from pydantic import ValidationError from src.schemas.api.search import SearchHit, SearchRequest, SearchResponse def test_search_hit_creation(): """Test SearchHit creation.""" hit = SearchHit( arxiv_id="2024.12345v1", title="Test Paper", authors="John Doe, Jane Smith", ...
"2024.12345v1"
assert
string_literal
tests/unit/schemas/test_search.py
test_search_hit_creation
64
null
jamwithai/production-agentic-rag-course
import os import pytest from src.config import Settings def test_settings_postgres_defaults(): """Test PostgreSQL default configuration.""" settings = Settings() assert "postgresql://" in
settings.postgres_database_url
assert
complex_expr
tests/unit/test_config.py
test_settings_postgres_defaults
21
null
jamwithai/production-agentic-rag-course
import pytest from unittest.mock import AsyncMock, Mock from langchain_core.messages import AIMessage, HumanMessage, ToolMessage from langgraph.runtime import Runtime from src.services.agents.nodes import ( ainvoke_retrieve_step, ainvoke_grade_documents_step, ainvoke_rewrite_query_step, ainvoke_generat...
result
assert
variable
tests/unit/services/agents/test_nodes.py
test_retrieve_creates_tool_call
TestRetrieveNode
68
null
jamwithai/production-agentic-rag-course
from pathlib import Path from unittest.mock import AsyncMock, MagicMock, mock_open, patch import httpx import pytest from src.exceptions import ArxivAPIException, ArxivAPITimeoutError, ArxivParseError, PDFDownloadException, PDFDownloadTimeoutError from src.schemas.arxiv.paper import ArxivPaper from src.services.arxiv....
"cs.AI"
assert
string_literal
tests/unit/services/test_arxiv_client.py
test_factory_creates_client
TestArxivClient
52
null