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 |
|---|---|---|---|---|---|---|---|---|---|
speaches-ai/speaches | from collections.abc import AsyncGenerator
from httpx import AsyncClient
from pydantic import SecretStr
import pytest
import pytest_asyncio
from tests.conftest import DEFAULT_CONFIG, AclientFactory
async def aclient_with_auth(aclient_factory: AclientFactory) -> AsyncGenerator[AsyncClient]:
"""Create a client wit... | response.headers | assert | complex_expr | tests/auth_test.py | test_www_authenticate_header_present | 134 | null | |
speaches-ai/speaches | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_srt_format_timestamp() -> None:
assert srt_format_timestamp(0.0) == "00:00:00,000"
assert srt_format_timestamp(1.0) == "00:00:01,000"
... | "00:01:00,000" | assert | string_literal | tests/text_utils_test.py | test_srt_format_timestamp | 17 | null | |
speaches-ai/speaches | from pathlib import Path
from openai import AsyncOpenAI, BadRequestError
import pytest
from speaches.api_types import TIMESTAMP_GRANULARITIES_COMBINATIONS, TimestampGranularities
@pytest.mark.asyncio
@pytest.mark.requires_openai
@pytest.mark.parametrize("timestamp_granularities", TIMESTAMP_GRANULARITIES_COMBINATIONS... | None | assert | none_literal | tests/openai_timestamp_granularities_test.py | test_openai_verbose_json_response_format_and_timestamp_granularities_combinations | 51 | null | |
speaches-ai/speaches | import openai
from openai import AsyncOpenAI
import pytest
MODEL_ID_THAT_EXISTS = "Systran/faster-whisper-tiny.en"
MODEL_ID_THAT_DOES_NOT_EXIST = "i-do-not-exist"
MIN_EXPECTED_NUMBER_OF_MODELS = 70 # At the time of the test creation there are 89 models
@pytest.mark.asyncio
async def test_model_does_not_exist(openai_... | openai.NotFoundError) | pytest.raises | complex_expr | tests/api_model_test.py | test_model_does_not_exist | 27 | null | |
zeenolife/ai-baby-monitor | from pathlib import Path
import yaml
from ai_baby_monitor.config import RoomConfig, load_room_config_file
def test_load_room_config_file_with_optional_fields(tmp_path: Path):
"""Test loading a config file with optional fields specified."""
sample = {
"name": "custom_room",
"camera": {
... | 100 | assert | numeric_literal | tests/configs/test_config_loader.py | test_load_room_config_file_with_optional_fields | 35 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import cv2
import numpy as np
import pytest
from ai_baby_monitor.stream.camera_stream import CameraStream, Frame
def mock_cv2_video_capture():
"""Fixture for a mock cv2.VideoCapture instance."""
capture = MagicMock(spec=cv2.VideoCapture)
ca... | mock_writer_instance | assert | variable | tests/stream/test_camera_stream.py | test_camera_stream_init_with_save | 87 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import cv2
import numpy as np
import pytest
from ai_baby_monitor.stream.camera_stream import CameraStream, Frame
def mock_cv2_video_capture():
"""Fixture for a mock cv2.VideoCapture instance."""
capture = MagicMock(spec=cv2.VideoCapture)
ca... | 1 | assert | numeric_literal | tests/stream/test_camera_stream.py | test_capture_new_frame_successful | 120 | null | |
zeenolife/ai-baby-monitor | from pathlib import Path
import yaml
from ai_baby_monitor.config import RoomConfig, load_room_config_file
def test_load_room_config_file_with_partial_optional_fields(tmp_path: Path):
"""Test loading a config file with only some optional fields specified."""
sample = {
"name": "partial_room",
... | 4 | assert | numeric_literal | tests/configs/test_config_loader.py | test_load_room_config_file_with_partial_optional_fields | 63 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | instructions) | assert_* | variable | tests/watcher/test_watcher.py | test_watcher_init | 84 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import redis # Imported for spec in MagicMock
from ai_baby_monitor.stream.camera_stream import Frame
from ai_baby_monitor.stream.redis_stream import RedisStreamHandler
def mock_redis_client():
"""Fixture for a mock... | maxlen | assert | variable | tests/stream/test_redis_stream.py | test_add_frame | 88 | null | |
zeenolife/ai-baby-monitor | from pathlib import Path
import yaml
from ai_baby_monitor.config import RoomConfig, load_room_config_file
def test_load_room_config_file_with_optional_fields(tmp_path: Path):
"""Test loading a config file with optional fields specified."""
sample = {
"name": "custom_room",
"camera": {
... | 720 | assert | numeric_literal | tests/configs/test_config_loader.py | test_load_room_config_file_with_optional_fields | 34 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | "test_model" | assert | string_literal | tests/watcher/test_watcher.py | test_watcher_init | 89 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | 3 | assert | numeric_literal | tests/watcher/test_watcher.py | test_watcher_calculate_fps_too_few_frames | 117 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | 2 | assert | numeric_literal | tests/watcher/test_watcher.py | test_watcher_calculate_fps_unreasonable_low_fps | 145 | null | |
zeenolife/ai-baby-monitor | from pathlib import Path
import yaml
from ai_baby_monitor.config import RoomConfig, load_room_config_file
def test_load_room_config_file_with_partial_optional_fields(tmp_path: Path):
"""Test loading a config file with only some optional fields specified."""
sample = {
"name": "partial_room",
... | 64 | assert | numeric_literal | tests/configs/test_config_loader.py | test_load_room_config_file_with_partial_optional_fields | 62 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import cv2
import numpy as np
import pytest
from ai_baby_monitor.stream.camera_stream import CameraStream, Frame
def mock_cv2_video_capture():
"""Fixture for a mock cv2.VideoCapture instance."""
capture = MagicMock(spec=cv2.VideoCapture)
ca... | None | assert | none_literal | tests/stream/test_camera_stream.py | test_camera_stream_init_successful | 76 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import redis # Imported for spec in MagicMock
from ai_baby_monitor.stream.camera_stream import Frame
from ai_baby_monitor.stream.redis_stream import RedisStreamHandler
def mock_redis_client():
"""Fixture for a mock... | 101 | assert | numeric_literal | tests/stream/test_redis_stream.py | test_get_latest_frames | 145 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | True | assert | bool_literal | tests/watcher/test_watcher.py | test_watcher_response_valid | 54 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | expected_prompt | assert | variable | tests/watcher/test_watcher.py | test_get_instructions_prompt_success | 25 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import redis # Imported for spec in MagicMock
from ai_baby_monitor.stream.camera_stream import Frame
from ai_baby_monitor.stream.redis_stream import RedisStreamHandler
def mock_redis_client():
"""Fixture for a mock... | dt.datetime( 2023, 1, 1, 12, 0, 1, tzinfo=dt.timezone.utc ) | assert | func_call | tests/stream/test_redis_stream.py | test_get_latest_frames | 142 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | "Baby is crying" | assert | string_literal | tests/watcher/test_watcher.py | test_watcher_response_valid | 55 | null | |
zeenolife/ai-baby-monitor | from pathlib import Path
import yaml
from ai_baby_monitor.config import RoomConfig, load_room_config_file
def test_load_room_config_file_with_optional_fields(tmp_path: Path):
"""Test loading a config file with optional fields specified."""
sample = {
"name": "custom_room",
"camera": {
... | 8 | assert | numeric_literal | tests/configs/test_config_loader.py | test_load_room_config_file_with_optional_fields | 36 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import redis # Imported for spec in MagicMock
from ai_baby_monitor.stream.camera_stream import Frame
from ai_baby_monitor.stream.redis_stream import RedisStreamHandler
def mock_redis_client():
"""Fixture for a mock... | sample_frame.frame_idx | assert | complex_expr | tests/stream/test_redis_stream.py | test_serialize_deserialize_frame | 55 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import redis # Imported for spec in MagicMock
from ai_baby_monitor.stream.camera_stream import Frame
from ai_baby_monitor.stream.redis_stream import RedisStreamHandler
def mock_redis_client():
"""Fixture for a mock... | mock_return_data_final_expected_order | assert | variable | tests/stream/test_redis_stream.py | test_get_latest_entries | 182 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import redis # Imported for spec in MagicMock
from ai_baby_monitor.stream.camera_stream import Frame
from ai_baby_monitor.stream.redis_stream import RedisStreamHandler
def mock_redis_client():
"""Fixture for a mock... | b"mock_entry_id" | assert | string_literal | tests/stream/test_redis_stream.py | test_add_frame | 83 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | 1234 | assert | numeric_literal | tests/watcher/test_watcher.py | test_watcher_init | 88 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | 5 | assert | numeric_literal | tests/watcher/test_watcher.py | test_watcher_calculate_fps_exception | 163 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import redis # Imported for spec in MagicMock
from ai_baby_monitor.stream.camera_stream import Frame
from ai_baby_monitor.stream.redis_stream import RedisStreamHandler
def mock_redis_client():
"""Fixture for a mock... | None | assert | none_literal | tests/stream/test_redis_stream.py | test_serialize_deserialize_frame | 67 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import cv2
import numpy as np
import pytest
from ai_baby_monitor.stream.camera_stream import CameraStream, Frame
def mock_cv2_video_capture():
"""Fixture for a mock cv2.VideoCapture instance."""
capture = MagicMock(spec=cv2.VideoCapture)
ca... | 0 | assert | numeric_literal | tests/stream/test_camera_stream.py | test_camera_stream_init_successful | 77 | null | |
zeenolife/ai-baby-monitor | from pathlib import Path
import yaml
from ai_baby_monitor.config import RoomConfig, load_room_config_file
def test_load_room_config_file_with_partial_optional_fields(tmp_path: Path):
"""Test loading a config file with only some optional fields specified."""
sample = {
"name": "partial_room",
... | 800 | assert | numeric_literal | tests/configs/test_config_loader.py | test_load_room_config_file_with_partial_optional_fields | 58 | null | |
zeenolife/ai-baby-monitor | from pathlib import Path
import yaml
from ai_baby_monitor.config import RoomConfig, load_room_config_file
def test_load_room_config_file_with_optional_fields(tmp_path: Path):
"""Test loading a config file with optional fields specified."""
sample = {
"name": "custom_room",
"camera": {
... | "custom_room" | assert | string_literal | tests/configs/test_config_loader.py | test_load_room_config_file_with_optional_fields | 28 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | "http://test_host:1234/v1/" | assert | string_literal | tests/watcher/test_watcher.py | test_watcher_init | 90 | null | |
zeenolife/ai-baby-monitor | from pathlib import Path
import yaml
from ai_baby_monitor.config import RoomConfig, load_room_config_file
def test_load_room_config_file_with_partial_optional_fields(tmp_path: Path):
"""Test loading a config file with only some optional fields specified."""
sample = {
"name": "partial_room",
... | 360 | assert | numeric_literal | tests/configs/test_config_loader.py | test_load_room_config_file_with_partial_optional_fields | 61 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | ValidationError) | pytest.raises | variable | tests/watcher/test_watcher.py | test_watcher_response_invalid_awareness_level | 64 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import redis # Imported for spec in MagicMock
from ai_baby_monitor.stream.camera_stream import Frame
from ai_baby_monitor.stream.redis_stream import RedisStreamHandler
def mock_redis_client():
"""Fixture for a mock... | expected_fields["timestamp"] | assert | complex_expr | tests/stream/test_redis_stream.py | test_add_frame | 93 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import redis # Imported for spec in MagicMock
from ai_baby_monitor.stream.camera_stream import Frame
from ai_baby_monitor.stream.redis_stream import RedisStreamHandler
def mock_redis_client():
"""Fixture for a mock... | key | assert | variable | tests/stream/test_redis_stream.py | test_add_frame | 87 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | AwarenessLevel.HIGH | assert | complex_expr | tests/watcher/test_watcher.py | test_watcher_response_valid | 56 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | 4 | assert | numeric_literal | tests/watcher/test_watcher.py | test_watcher_calculate_fps_zero_time_diff | 126 | null | |
zeenolife/ai-baby-monitor | import pytest
from ai_baby_monitor.watcher.base_prompt import get_instructions_prompt
from ai_baby_monitor.watcher import WatcherResponse, AwarenessLevel
from pydantic import ValidationError
from unittest.mock import patch
from ai_baby_monitor.watcher import Watcher
from ai_baby_monitor.stream import Frame
import datet... | 1 | assert | numeric_literal | tests/watcher/test_watcher.py | test_watcher_calculate_fps_valid | 101 | null | |
zeenolife/ai-baby-monitor | import datetime as dt
from unittest.mock import MagicMock, patch
import cv2
import numpy as np
import pytest
from ai_baby_monitor.stream.camera_stream import CameraStream, Frame
def mock_cv2_video_capture():
"""Fixture for a mock cv2.VideoCapture instance."""
capture = MagicMock(spec=cv2.VideoCapture)
ca... | dt.datetime(2023, 1, 1, 10, 0, 0) | assert | func_call | tests/stream/test_camera_stream.py | test_capture_new_frame_successful | 119 | null | |
benbusby/whoogle-search | from app.models.endpoint import Endpoint
def test_autocomplete_get(client):
rv = client.get(f'/{Endpoint.autocomplete}?q=green+eggs+and')
assert rv._status_code == | 200 | assert | numeric_literal | test/test_autocomplete.py | test_autocomplete_get | 6 | null | |
benbusby/whoogle-search | import json
import types
import pytest
from app.models.endpoint import Endpoint
from app.utils import search as search_mod
def stubbed_search_response(monkeypatch):
# Stub Search.new_search_query to return a stable query
def fake_new_query(self):
self.query = 'whoogle'
return self.query
... | result | assert | variable | test/test_json.py | test_search_json_accept | 46 | null | |
benbusby/whoogle-search | import json
import types
import pytest
from app.models.endpoint import Endpoint
from app.utils import search as search_mod
def stubbed_search_response(monkeypatch):
# Stub Search.new_search_query to return a stable query
def fake_new_query(self):
self.query = 'whoogle'
return self.query
... | 200 | assert | numeric_literal | test/test_json.py | test_search_json_accept | 35 | null | |
benbusby/whoogle-search | import copy
import os
from bs4 import BeautifulSoup
from app import app
from app.filter import Filter
from app.models.config import Config
from app.utils.session import generate_key
from app.utils import results as results_mod
def build_soup(html: str):
return BeautifulSoup(html, 'html.parser')
def make_filter(... | text | assert | variable | test/test_alts.py | test_wikipedia_simple_no_lang_param | 78 | null | |
benbusby/whoogle-search | from app import app
from app.models.endpoint import Endpoint
import json
from test.conftest import demo_config
def test_main(client):
rv = client.get('/')
assert rv._status_code == | 200 | assert | numeric_literal | test/test_routes.py | test_main | 11 | null | |
benbusby/whoogle-search | from cryptography.fernet import Fernet
from app import app
from app.models.endpoint import Endpoint
from app.utils.session import generate_key, valid_user_session
JAPAN_PREFS = 'uG7IBICwK7FgMJNpUawp2tKDb1Omuv_euy-cJHVZ' \
+ 'BSydthgwxRFIHxiVA8qUGavKaDXyiM5uNuPIjKbEAW-zB_vzNXWVaafFhW7k2' \
+ 'fO2_mS5e5eK41XXWwiViT... | en_keys | assert | variable | test/test_misc.py | test_valid_translation_keys | 35 | null | |
benbusby/whoogle-search | from app.models.endpoint import Endpoint
def test_autocomplete_get(client):
rv = client.get(f'/{Endpoint.autocomplete}?q=green+eggs+and')
assert rv._status_code == 200
assert len(rv.data) >= | 1 | assert | numeric_literal | test/test_autocomplete.py | test_autocomplete_get | 7 | null | |
benbusby/whoogle-search | from app import app
from app.models.endpoint import Endpoint
import json
from test.conftest import demo_config
def test_config(client):
rv = client.post(f'/{Endpoint.config}', data=demo_config)
assert rv._status_code == 302
rv = client.get(f'/{Endpoint.config}')
assert rv._status_code == 200
co... | demo_config[key] | assert | complex_expr | test/test_routes.py | test_config | 74 | null | |
benbusby/whoogle-search | from app import app
from app.models.endpoint import Endpoint
import json
from test.conftest import demo_config
def test_feeling_lucky(client):
# Bang at beginning of query
rv = client.get(f'/{Endpoint.search}?q=!%20wikipedia')
assert rv._status_code == | 303 | assert | numeric_literal | test/test_routes.py | test_feeling_lucky | 22 | null | |
benbusby/whoogle-search | from bs4 import BeautifulSoup
from app.filter import Filter
from app.models.config import Config
from app.models.endpoint import Endpoint
from app.utils import results
from app.utils import search as search_mod
from app.utils.session import generate_key
from datetime import datetime
from dateutil.parser import ParserEr... | num_days + 5 | assert | complex_expr | test/test_results.py | test_recent_results | 143 | null | |
benbusby/whoogle-search | import copy
import os
from bs4 import BeautifulSoup
from app import app
from app.filter import Filter
from app.models.config import Config
from app.utils.session import generate_key
from app.utils import results as results_mod
def build_soup(html: str):
return BeautifulSoup(html, 'html.parser')
def make_filter(... | a['href'] | assert | complex_expr | test/test_alts.py | test_wikipedia_simple_no_lang_param | 74 | null | |
benbusby/whoogle-search | import json
import types
import pytest
from app.models.endpoint import Endpoint
from app.utils import search as search_mod
def stubbed_search_response(monkeypatch):
# Stub Search.new_search_query to return a stable query
def fake_new_query(self):
self.query = 'whoogle'
return self.query
... | 303 | assert | numeric_literal | test/test_json.py | test_search_json_feeling_lucky | 75 | null | |
benbusby/whoogle-search | from bs4 import BeautifulSoup
from app.filter import Filter
from app.models.config import Config
from app.models.endpoint import Endpoint
from app.utils import results
from app.utils import search as search_mod
from app.utils.session import generate_key
from datetime import datetime
from dateutil.parser import ParserEr... | 'http://yt.endswithwww.domain' | assert | string_literal | test/test_results.py | test_site_alt_prefix_skip | 184 | null | |
benbusby/whoogle-search | from app import app
from app.models.endpoint import Endpoint
import json
from test.conftest import demo_config
def test_config(client):
rv = client.post(f'/{Endpoint.config}', data=demo_config)
assert rv._status_code == 302
rv = client.get(f'/{Endpoint.config}')
assert rv._status_code == 200
co... | 403 | assert | numeric_literal | test/test_routes.py | test_config | 81 | null | |
benbusby/whoogle-search | import json
import pytest
from app.models.endpoint import Endpoint
from app.utils import search as search_mod
def test_captcha_json_block(client, monkeypatch):
def fake_new_query(self):
self.query = 'test'
return self.query
def fake_generate(self):
# Inject a captcha marker into HTML... | True | assert | bool_literal | test/test_routes_json.py | test_captcha_json_block | 24 | null | |
benbusby/whoogle-search | import pytest
from app import app
from app.request import Request, TorError
from app.models.config import Config
def build_config(tor: bool) -> Config:
# Minimal config with tor flag
with app.app_context():
return Config(**{'tor': tor})
def test_tor_validation_success(monkeypatch):
# Prevent real... | 200 | assert | numeric_literal | test/test_tor.py | test_tor_validation_success | 42 | null | |
benbusby/whoogle-search | import json
import pytest
from app.models.endpoint import Endpoint
from app.utils import search as search_mod
def test_captcha_json_block(client, monkeypatch):
def fake_new_query(self):
self.query = 'test'
return self.query
def fake_generate(self):
# Inject a captcha marker into HTML... | data | assert | variable | test/test_routes_json.py | test_captcha_json_block | 25 | null | |
benbusby/whoogle-search | import copy
import os
from bs4 import BeautifulSoup
from app import app
from app.filter import Filter
from app.models.config import Config
from app.utils.session import generate_key
from app.utils import results as results_mod
def build_soup(html: str):
return BeautifulSoup(html, 'html.parser')
def make_filter(... | divs | assert | variable | test/test_alts.py | test_no_duplicate_alt_prefix_reddit | 49 | null | |
benbusby/whoogle-search | import json
import pytest
from app.models.endpoint import Endpoint
from app.utils import search as search_mod
def test_captcha_json_block(client, monkeypatch):
def fake_new_query(self):
self.query = 'test'
return self.query
def fake_generate(self):
# Inject a captcha marker into HTML... | 503 | assert | numeric_literal | test/test_routes_json.py | test_captcha_json_block | 22 | null | |
benbusby/whoogle-search | from app import app
from app.models.endpoint import Endpoint
import json
from test.conftest import demo_config
def test_ddg_bang(client):
# Bang at beginning of query
rv = client.get(f'/{Endpoint.search}?q=!gh%20whoogle')
assert rv._status_code == | 302 | assert | numeric_literal | test/test_routes.py | test_ddg_bang | 34 | null | |
benbusby/whoogle-search | from bs4 import BeautifulSoup
from app.filter import Filter
from app.models.config import Config
from app.models.endpoint import Endpoint
from app.utils import results
from app.utils import search as search_mod
from app.utils.session import generate_key
from datetime import datetime
from dateutil.parser import ParserEr... | 15 | assert | numeric_literal | test/test_results.py | test_get_results | 53 | null | |
benbusby/whoogle-search | from app import app
from app.models.endpoint import Endpoint
import json
from test.conftest import demo_config
def test_opensearch(client):
rv = client.get(f'/{Endpoint.opensearch}')
assert rv._status_code == 200
assert '<ShortName>Whoogle</ShortName>' in | str(rv.data) | assert | func_call | test/test_routes.py | test_opensearch | 91 | null | |
benbusby/whoogle-search | from bs4 import BeautifulSoup
from app.filter import Filter
from app.models.config import Config
from app.models.endpoint import Endpoint
from app.utils import results
from app.utils import search as search_mod
from app.utils.session import generate_key
from datetime import datetime
from dateutil.parser import ParserEr... | 'pinterest.com' | assert | string_literal | test/test_results.py | test_block_results | 94 | null | |
benbusby/whoogle-search | from bs4 import BeautifulSoup
from app.filter import Filter
from app.models.config import Config
from app.models.endpoint import Endpoint
from app.utils import results
from app.utils import search as search_mod
from app.utils.session import generate_key
from datetime import datetime
from dateutil.parser import ParserEr... | 10 | assert | numeric_literal | test/test_results.py | test_get_results | 52 | null | |
benbusby/whoogle-search | from cryptography.fernet import Fernet
from app import app
from app.models.endpoint import Endpoint
from app.utils.session import generate_key, valid_user_session
JAPAN_PREFS = 'uG7IBICwK7FgMJNpUawp2tKDb1Omuv_euy-cJHVZ' \
+ 'BSydthgwxRFIHxiVA8qUGavKaDXyiM5uNuPIjKbEAW-zB_vzNXWVaafFhW7k2' \
+ 'fO2_mS5e5eK41XXWwiViT... | 200 | assert | numeric_literal | test/test_misc.py | test_query_decryption | 48 | null | |
benbusby/whoogle-search | import json
import types
import pytest
from app.models.endpoint import Endpoint
from app.utils import search as search_mod
def stubbed_search_response(monkeypatch):
# Stub Search.new_search_query to return a stable query
def fake_new_query(self):
self.query = 'whoogle'
return self.query
... | 2 | assert | numeric_literal | test/test_json.py | test_search_json_format_param | 57 | null | |
benbusby/whoogle-search | from app.models.endpoint import Endpoint
def test_autocomplete_get(client):
rv = client.get(f'/{Endpoint.autocomplete}?q=green+eggs+and')
assert rv._status_code == 200
assert len(rv.data) >= 1
assert b'green eggs and ham' in | rv.data | assert | complex_expr | test/test_autocomplete.py | test_autocomplete_get | 8 | null | |
benbusby/whoogle-search | from bs4 import BeautifulSoup
from app.filter import Filter
from app.models.config import Config
from app.models.endpoint import Endpoint
from app.utils import results
from app.utils import search as search_mod
from app.utils.session import generate_key
from datetime import datetime
from dateutil.parser import ParserEr... | str_data | assert | variable | test/test_results.py | test_translate_search | 67 | null | |
benbusby/whoogle-search | import types
import httpx
import pytest
from app.services.http_client import HttpxClient
def test_httpxclient_follow_redirects_and_proxy(monkeypatch):
calls = []
class FakeClient:
def __init__(self, *args, **kwargs):
calls.append(kwargs)
def get(self, *args, **kwargs):
... | True | assert | bool_literal | test/test_http_client.py | test_httpxclient_follow_redirects_and_proxy | 31 | null | |
benbusby/whoogle-search | import pytest
from app import app
from app.request import Request, TorError
from app.models.config import Config
def build_config(tor: bool) -> Config:
# Minimal config with tor flag
with app.app_context():
return Config(**{'tor': tor})
def test_tor_validation_failure(monkeypatch):
# Prevent real... | TorError) | pytest.raises | variable | test/test_tor.py | test_tor_validation_failure | 50 | null | |
benbusby/whoogle-search | from app import app
from app.request import Request
from app.models.config import Config
def test_autocomplete_parsing():
with app.app_context():
cfg = Config(**{})
req = Request(normal_ua='UA', root_path='http://localhost:5000', config=cfg, http_client=FakeHttpClient())
suggestions = req.autocompl... | suggestions | assert | variable | test/test_autocomplete_xml.py | test_autocomplete_parsing | 29 | null | |
benbusby/whoogle-search | from cryptography.fernet import Fernet
from app import app
from app.models.endpoint import Endpoint
from app.utils.session import generate_key, valid_user_session
JAPAN_PREFS = 'uG7IBICwK7FgMJNpUawp2tKDb1Omuv_euy-cJHVZ' \
+ 'BSydthgwxRFIHxiVA8qUGavKaDXyiM5uNuPIjKbEAW-zB_vzNXWVaafFhW7k2' \
+ 'fO2_mS5e5eK41XXWwiViT... | key | assert | variable | test/test_misc.py | test_generate_user_keys | 17 | null | |
benbusby/whoogle-search | import json
import types
import pytest
from app.models.endpoint import Endpoint
from app.utils import search as search_mod
def stubbed_search_response(monkeypatch):
# Stub Search.new_search_query to return a stable query
def fake_new_query(self):
self.query = 'whoogle'
return self.query
... | 'https://example.com/lucky' | assert | string_literal | test/test_json.py | test_search_json_feeling_lucky | 77 | null | |
benbusby/whoogle-search | import pytest
from app import app
from app.request import Request, TorError
from app.models.config import Config
def build_config(tor: bool) -> Config:
# Minimal config with tor flag
with app.app_context():
return Config(**{'tor': tor})
def test_tor_validation_success(monkeypatch):
# Prevent real... | True | assert | bool_literal | test/test_tor.py | test_tor_validation_success | 41 | null | |
benbusby/whoogle-search | from bs4 import BeautifulSoup
from app.filter import Filter
from app.models.config import Config
from app.models.endpoint import Endpoint
from app.utils import results
from app.utils import search as search_mod
from app.utils.session import generate_key
from datetime import datetime
from dateutil.parser import ParserEr... | 'https://farside.link/libreddit' | assert | string_literal | test/test_results.py | test_site_alt_prefix_skip | 172 | null | |
benbusby/whoogle-search | from bs4 import BeautifulSoup
from app.filter import Filter
from app.models.config import Config
from app.models.endpoint import Endpoint
from app.utils import results
from app.utils import search as search_mod
from app.utils.session import generate_key
from datetime import datetime
from dateutil.parser import ParserEr... | 'https://farside.link/nitter' | assert | string_literal | test/test_results.py | test_site_alt_prefix_skip | 173 | null | |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs.utils.core as ahrs_core
class TestCoreFunctions(unittest.TestCase):
def test_assert_numerical_iterable(self):
self.assertRaises( | TypeError) | self.assertRaises | variable | tests/test_core_functions.py | test_assert_numerical_iterable | TestCoreFunctions | 11 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
THRESHOLD = 0.5
SENSOR_DATA = ahrs.Sensors(num_samples=1000, in_degrees=False)
REFERENCE_QUATERNIONS = SENSOR_DATA.quaternions
REFERENCE_ROTATIONS = SENSOR_DATA.rotations
class TestAQUA(unittest.TestCase):
def setUp(self) -> None:
self.gyroscopes = np.copy(S... | 0.0) | self.assertGreater | numeric_literal | tests/test_estimators.py | test_adaptive_gain | TestAQUA | 353 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
GENERATOR = np.random.default_rng(42)
THRESHOLD = 1e-6
SQRT2_2 = np.sqrt(2)/2
class TestDCM(unittest.TestCase):
def setUp(self) -> None:
self.R0 = ahrs.DCM()
self.vector = GENERATOR.random(3)*180-90
self.R = ahrs.DCM(rpy=self.vector)
s... | rmz45) | assert_* | variable | tests/test_dcm.py | test_rotation_matrix_from_euler_angles | TestDCM | 40 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
SQ22 = np.sqrt(2)/2
class TestGeometry(unittest.TestCase):
def test_geometry_circle_default(self):
circle = ahrs.common.geometry.circle([0, 0])
self.assertEqual(circle.max(), 1.0)
self.assertEqual(circle.min(), -1.0)
self.assertEqual(... | 2.0) | self.assertEqual | numeric_literal | tests/test_common_tools.py | test_geometry_circle_default | TestGeometry | 14 | null |
Mayitzin/ahrs | import unittest
import ahrs
class TestWGS84(unittest.TestCase):
def setUp(self) -> None:
self.wgs = ahrs.utils.WGS()
def test_normal_gravity(self):
self.assertEqual(self.wgs.normal_gravity(50.0), 9.810702135603085)
self.assertEqual(self.wgs.normal_gravity(50.0, 100.0), | 9.810393625316983) | self.assertEqual | numeric_literal | tests/test_wgs84.py | test_normal_gravity | TestWGS84 | 22 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
SQ22 = np.sqrt(2)/2
COS_SQ22 = np.cos(SQ22)
SIN_SQ22 = np.sin(SQ22)
EXP_SQ22 = np.exp(SQ22)
class TestQuaternion(unittest.TestCase):
def setUp(self) -> None:
# Identity Quaternion
self.q0 = ahrs.Quaternion()
# Versor from 3D array
self... | 1.0) | self.assertEqual | numeric_literal | tests/test_quaternions.py | test_identity_quaternion | TestQuaternion | 27 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
SQ22 = np.sqrt(2)/2
class TestGeometry(unittest.TestCase):
def test_geometry_circle_custom(self):
circle = ahrs.common.geometry.circle([1, 1], 2.0, 10)
self.assertEqual(circle.max(), 3.0)
self.assertEqual(circle.min(), -1.0)
self.ass... | 4.0) | self.assertEqual | numeric_literal | tests/test_common_tools.py | test_geometry_circle_custom | TestGeometry | 23 | null |
Mayitzin/ahrs | import unittest
import ahrs
class TestWGS84(unittest.TestCase):
def setUp(self) -> None:
self.wgs = ahrs.utils.WGS()
def test_normal_gravity(self):
self.assertEqual(self.wgs.normal_gravity(50.0), | 9.810702135603085) | self.assertEqual | numeric_literal | tests/test_wgs84.py | test_normal_gravity | TestWGS84 | 21 | null |
Mayitzin/ahrs | import unittest
import ahrs
class TestWELMEC(unittest.TestCase):
def test_correct_values(self):
self.assertAlmostEqual(ahrs.utils.welmec_gravity(52.3, 80.0), | 9.812484) | self.assertAlmostEqual | numeric_literal | tests/test_wgs84.py | test_correct_values | TestWELMEC | 7 | null |
Mayitzin/ahrs | import unittest
import ahrs
class TestWGS84(unittest.TestCase):
def setUp(self) -> None:
self.wgs = ahrs.utils.WGS()
def test_normal_gravity(self):
self.assertEqual(self.wgs.normal_gravity(50.0), 9.810702135603085)
self.assertEqual(self.wgs.normal_gravity(50.0, 100.0), 9.81039362531698... | 9.7803253359) | self.assertAlmostEqual | numeric_literal | tests/test_wgs84.py | test_normal_gravity | TestWGS84 | 23 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
SQ22 = np.sqrt(2)/2
class TestGeometry(unittest.TestCase):
def test_geometry_circle_default(self):
circle = ahrs.common.geometry.circle([0, 0])
self.assertEqual(circle.max(), 1.0)
self.assertEqual(circle.min(), -1.0)
self.assertEqual(n... | 0.0) | self.assertAlmostEqual | numeric_literal | tests/test_common_tools.py | test_geometry_circle_default | TestGeometry | 16 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
GENERATOR = np.random.default_rng(42)
THRESHOLD = 1e-6
SQRT2_2 = np.sqrt(2)/2
class TestDCM(unittest.TestCase):
def setUp(self) -> None:
self.R0 = ahrs.DCM()
self.vector = GENERATOR.random(3)*180-90
self.R = ahrs.DCM(rpy=self.vector)
s... | TypeError) | self.assertRaises | variable | tests/test_dcm.py | test_wrong_input_matrix | TestDCM | 60 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
THRESHOLD = 0.5
SENSOR_DATA = ahrs.Sensors(num_samples=1000, in_degrees=False)
REFERENCE_QUATERNIONS = SENSOR_DATA.quaternions
REFERENCE_ROTATIONS = SENSOR_DATA.rotations
class TestTRIAD(unittest.TestCase):
def setUp(self) -> None:
self.accelerometers = np.c... | TypeError) | self.assertRaises | variable | tests/test_estimators.py | test_wrong_frame | TestTRIAD | 24 | null |
Mayitzin/ahrs | import unittest
import ahrs
class TestInternationalGravity(unittest.TestCase):
def test_correct_values(self):
self.assertEqual(ahrs.utils.international_gravity(10.0), 9.781924844039924)
self.assertEqual(ahrs.utils.international_gravity(10.0, epoch='1930'), | 9.7820428934191) | self.assertEqual | numeric_literal | tests/test_wgs84.py | test_correct_values | TestInternationalGravity | 13 | null |
Mayitzin/ahrs | import os
import unittest
import numpy as np
import ahrs
class TestWMM(unittest.TestCase):
def _load_test_values(self, filename: str) -> np.ndarray:
"""
Load test values from file.
Parameters
----------
filename : str
Path to file with test values.
Ret... | f"Expected {test_values['X'][i]:.1f}, result {self.wmm.X:.1f}") | self.assertAlmostEqual | string_literal | tests/test_wmm.py | test_wmm2015 | TestWMM | 84 | null |
Mayitzin/ahrs | import unittest
import ahrs
class TestWGS84(unittest.TestCase):
def setUp(self) -> None:
self.wgs = ahrs.utils.WGS()
def test_values(self):
self.assertAlmostEqual(self.wgs.a, 6_378_137.0, 1)
self.assertAlmostEqual(self.wgs.f, 1/298.257223563, | 7) | self.assertAlmostEqual | numeric_literal | tests/test_wgs84.py | test_values | TestWGS84 | 28 | null |
Mayitzin/ahrs | import os
import unittest
import numpy as np
import ahrs
class TestWMM(unittest.TestCase):
def _load_test_values(self, filename: str) -> np.ndarray:
"""
Load test values from file.
Parameters
----------
filename : str
Path to file with test values.
Ret... | f"Expected {test_values['Y'][i]:.1f}, result {self.wmm.Y:.1f}") | self.assertAlmostEqual | string_literal | tests/test_wmm.py | test_wmm2015 | TestWMM | 85 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
SQ22 = np.sqrt(2)/2
class TestGeometry(unittest.TestCase):
def test_geometry_circle_default(self):
circle = ahrs.common.geometry.circle([0, 0])
self.assertEqual(circle.max(), | 1.0) | self.assertEqual | numeric_literal | tests/test_common_tools.py | test_geometry_circle_default | TestGeometry | 12 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
SQ22 = np.sqrt(2)/2
COS_SQ22 = np.cos(SQ22)
SIN_SQ22 = np.sin(SQ22)
EXP_SQ22 = np.exp(SQ22)
class TestQuaternionArray(unittest.TestCase):
def setUp(self) -> None:
self.Q0 = ahrs.QuaternionArray()
self.Q1 = ahrs.QuaternionArray(np.identity(4))
... | Q_conj) | assert_* | variable | tests/test_quaternions.py | test_conjugate | TestQuaternionArray | 338 | null |
Mayitzin/ahrs | import unittest
import ahrs
class TestWGS84(unittest.TestCase):
def setUp(self) -> None:
self.wgs = ahrs.utils.WGS()
def test_values(self):
self.assertAlmostEqual(self.wgs.a, 6_378_137.0, | 1) | self.assertAlmostEqual | numeric_literal | tests/test_wgs84.py | test_values | TestWGS84 | 27 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
SQ22 = np.sqrt(2)/2
COS_SQ22 = np.cos(SQ22)
SIN_SQ22 = np.sin(SQ22)
EXP_SQ22 = np.exp(SQ22)
class TestQuaternionArray(unittest.TestCase):
def setUp(self) -> None:
self.Q0 = ahrs.QuaternionArray()
self.Q1 = ahrs.QuaternionArray(np.identity(4))
... | [1.0]) | self.assertEqual | collection | tests/test_quaternions.py | test_identity_quaternion | TestQuaternionArray | 287 | null |
Mayitzin/ahrs | import unittest
import ahrs
class TestInternationalGravity(unittest.TestCase):
def test_correct_values(self):
self.assertEqual(ahrs.utils.international_gravity(10.0), | 9.781924844039924) | self.assertEqual | numeric_literal | tests/test_wgs84.py | test_correct_values | TestInternationalGravity | 12 | null |
Mayitzin/ahrs | import unittest
import ahrs
class TestWGS84(unittest.TestCase):
def setUp(self) -> None:
self.wgs = ahrs.utils.WGS()
def test_normal_gravity(self):
self.assertEqual(self.wgs.normal_gravity(50.0), 9.810702135603085)
self.assertEqual(self.wgs.normal_gravity(50.0, 100.0), 9.81039362531698... | 9.8321849379) | self.assertAlmostEqual | numeric_literal | tests/test_wgs84.py | test_normal_gravity | TestWGS84 | 24 | null |
Mayitzin/ahrs | import unittest
import numpy as np
import ahrs
class TestEuclidean(unittest.TestCase):
def test_correct_values(self):
self.assertEqual(ahrs.utils.euclidean(np.zeros(3), np.zeros(3)), | 0.0) | self.assertEqual | numeric_literal | tests/test_metrics.py | test_correct_values | TestEuclidean | 8 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.