repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
AnonymouX47/term-image | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | train | train | tests/test_widget/test_urwid.py | test_alloc | assert | numeric_literal | 44 | import gc
import io
import sys
from contextlib import contextmanager
import pytest
import urwid
from PIL import Image
from term_image import ctlseqs
from term_image.exceptions import RenderError, UrwidImageError
from term_image.image import (
BlockImage,
GraphicsImage,
ITerm2Image,
KittyImage,
Siz... | 5 | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | v2_extractor_at_anchor |
AnonymouX47/term-image | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | train | train | tests/test_widget/test_urwid.py | test_free | assert | numeric_literal | 45 | import gc
import io
import sys
from contextlib import contextmanager
import pytest
import urwid
from PIL import Image
from term_image import ctlseqs
from term_image.exceptions import RenderError, UrwidImageError
from term_image.image import (
BlockImage,
GraphicsImage,
ITerm2Image,
KittyImage,
Siz... | 6 | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | v2_extractor_at_anchor |
AnonymouX47/term-image | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | train | train | tests/test_widget/test_urwid.py | test_move_top_widget | assert | numeric_literal | 173 | import gc
import io
import sys
from contextlib import contextmanager
import pytest
import urwid
from PIL import Image
from term_image import ctlseqs
from term_image.exceptions import RenderError, UrwidImageError
from term_image.image import (
BlockImage,
GraphicsImage,
ITerm2Image,
KittyImage,
Siz... | 2 | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | v2_extractor_at_anchor |
AnonymouX47/term-image | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | train | train | tests/test_widget/test_urwid.py | test_move_top_widget | assert | numeric_literal | 190 | import gc
import io
import sys
from contextlib import contextmanager
import pytest
import urwid
from PIL import Image
from term_image import ctlseqs
from term_image.exceptions import RenderError, UrwidImageError
from term_image.image import (
BlockImage,
GraphicsImage,
ITerm2Image,
KittyImage,
Siz... | 8 | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | v2_extractor_at_anchor |
AnonymouX47/term-image | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | train | train | tests/test_widget/test_urwid.py | test_scroll_listboxes | assert | numeric_literal | 159 | import gc
import io
import sys
from contextlib import contextmanager
import pytest
import urwid
from PIL import Image
from term_image import ctlseqs
from term_image.exceptions import RenderError, UrwidImageError
from term_image.image import (
BlockImage,
GraphicsImage,
ITerm2Image,
KittyImage,
Siz... | 4 | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | v2_extractor_at_anchor |
AnonymouX47/term-image | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | train | train | tests/test_widget/test_urwid.py | test_change_top_widget | assert | numeric_literal | 157 | import gc
import io
import sys
from contextlib import contextmanager
import pytest
import urwid
from PIL import Image
from term_image import ctlseqs
from term_image.exceptions import RenderError, UrwidImageError
from term_image.image import (
BlockImage,
GraphicsImage,
ITerm2Image,
KittyImage,
Siz... | 9 | d95a63591c4ed1fde0378e0e50d8b626203cc276 | 119 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/e2e.py | handle | assert | numeric_literal | 53 | import socket
import time
from collections.abc import Generator
from contextlib import closing
from multiprocessing import Process
import pytest
import requests
import uvicorn
from playwright.sync_api import Page, Route, expect
import fastapi_app as app
expect.set_options(timeout=10_000)
def wait_for_server_ready(u... | 1 | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/e2e.py | handle | assert | none_literal | 52 | import socket
import time
from collections.abc import Generator
from contextlib import closing
from multiprocessing import Process
import pytest
import requests
import uvicorn
from playwright.sync_api import Page, Route, expect
import fastapi_app as app
expect.set_options(timeout=10_000)
def wait_for_server_ready(u... | None | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/e2e.py | handle | assert | bool_literal | 51 | import socket
import time
from collections.abc import Generator
from contextlib import closing
from multiprocessing import Process
import pytest
import requests
import uvicorn
from playwright.sync_api import Page, Route, expect
import fastapi_app as app
expect.set_options(timeout=10_000)
def wait_for_server_ready(u... | False | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/e2e.py | handle | assert | string_literal | 52 | import socket
import time
from collections.abc import Generator
from contextlib import closing
from multiprocessing import Process
import pytest
import requests
import uvicorn
from playwright.sync_api import Page, Route, expect
import fastapi_app as app
expect.set_options(timeout=10_000)
def wait_for_server_ready(u... | "vectors" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/e2e.py | handle | assert | string_literal | 54 | import socket
import time
from collections.abc import Generator
from contextlib import closing
from multiprocessing import Process
import pytest
import requests
import uvicorn
from playwright.sync_api import Page, Route, expect
import fastapi_app as app
expect.set_options(timeout=10_000)
def wait_for_server_ready(u... | "You are a cat and only talk about tuna." | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_api_routes.py | test_item_handler | assert | numeric_literal | 14 | import json
import pytest
from tests.data import test_data
@pytest.mark.asyncio
async def test_item_handler(test_client):
"""test the item_handler route"""
response = test_client.get(f"/items/{test_data.id}")
response_data = response.json()
assert response.status_code == | 200 | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_api_routes.py | test_item_handler_404 | assert | numeric_literal | 14 | import json
import pytest
from tests.data import test_data
@pytest.mark.asyncio
async def test_item_handler_404(test_client):
"""test the item_handler route with a non-existent item"""
item_id = 10000000
response = test_client.get(f"/items/{item_id}")
assert response.status_code == | 404 | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_api_routes.py | test_similar_handler_422 | assert | numeric_literal | 13 | import json
import pytest
from tests.data import test_data
@pytest.mark.asyncio
async def test_similar_handler_422(test_client):
"""test the similar_handler route with missing query parameters"""
response = test_client.get("/similar")
assert response.status_code == | 422 | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_api_routes.py | test_item_handler_404 | assert | string_literal | 16 | import json
import pytest
from tests.data import test_data
@pytest.mark.asyncio
async def test_item_handler_404(test_client):
"""test the item_handler route with a non-existent item"""
item_id = 10000000
response = test_client.get(f"/items/{item_id}")
assert response.status_code == 404
assert re... | "45" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_api_routes.py | test_similar_handler_422 | assert | string_literal | 15 | import json
import pytest
from tests.data import test_data
@pytest.mark.asyncio
async def test_similar_handler_422(test_client):
"""test the similar_handler route with missing query parameters"""
response = test_client.get("/similar")
assert response.status_code == 422
assert response.headers["Conte... | "88" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_api_routes.py | test_search_handler_422 | assert | string_literal | 15 | import json
import pytest
from tests.data import test_data
@pytest.mark.asyncio
async def test_search_handler_422(test_client):
"""test the search_handler route with missing query parameters"""
response = test_client.get("/search")
assert response.status_code == 422
assert response.headers["Content-... | "91" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_api_routes.py | test_chat_non_json_422 | assert | string_literal | 15 | import json
import pytest
from tests.data import test_data
@pytest.mark.asyncio
async def test_chat_non_json_422(test_client):
"""test the chat route with a non-json request"""
response = test_client.post("/chat")
assert response.status_code == 422
assert response.headers["Content-Type"] == "applica... | "82" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_api_routes.py | test_item_handler | assert | complex_expr | 16 | import json
import pytest
from tests.data import test_data
@pytest.mark.asyncio
async def test_item_handler(test_client):
"""test the item_handler route"""
response = test_client.get(f"/items/{test_data.id}")
response_data = response.json()
assert response.status_code == 200
assert response.head... | test_data.id | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_api_routes.py | test_item_handler | assert | complex_expr | 17 | import json
import pytest
from tests.data import test_data
@pytest.mark.asyncio
async def test_item_handler(test_client):
"""test the item_handler route"""
response = test_client.get(f"/items/{test_data.id}")
response_data = response.json()
assert response.status_code == 200
assert response.head... | test_data.name | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_dependencies.py | test_get_azure_credential | assert | string_literal | 11 | import pytest
from fastapi_app.dependencies import common_parameters, get_azure_credential
@pytest.mark.asyncio
async def test_get_azure_credential(mock_session_env, mock_azure_credential):
result = await get_azure_credential()
token = result.get_token("https://vault.azure.net")
assert token.expires_on ==... | "" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_dependencies.py | test_get_common_parameters | assert | numeric_literal | 11 | import pytest
from fastapi_app.dependencies import common_parameters, get_azure_credential
@pytest.mark.asyncio
async def test_get_common_parameters(mock_session_env):
result = await common_parameters()
assert result.openai_chat_model == "gpt-4o-mini"
assert result.openai_embed_model == "text-embedding-3-... | 1024 | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_dependencies.py | test_get_common_parameters_ollama | assert | none_literal | 11 | import pytest
from fastapi_app.dependencies import common_parameters, get_azure_credential
@pytest.mark.asyncio
async def test_get_common_parameters_ollama(mock_session_env_ollama):
result = await common_parameters()
assert result.openai_chat_model == "llama3.1"
assert result.openai_embed_model == "nomic-... | None | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_dependencies.py | test_get_common_parameters_ollama | assert | string_literal | 9 | import pytest
from fastapi_app.dependencies import common_parameters, get_azure_credential
@pytest.mark.asyncio
async def test_get_common_parameters_ollama(mock_session_env_ollama):
result = await common_parameters()
assert result.openai_chat_model == | "llama3.1" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_dependencies.py | test_get_azure_credential | assert | numeric_literal | 10 | import pytest
from fastapi_app.dependencies import common_parameters, get_azure_credential
@pytest.mark.asyncio
async def test_get_azure_credential(mock_session_env, mock_azure_credential):
result = await get_azure_credential()
token = result.get_token("https://vault.azure.net")
assert token.expires_on =... | 9999999999 | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_dependencies.py | test_get_common_parameters | assert | string_literal | 9 | import pytest
from fastapi_app.dependencies import common_parameters, get_azure_credential
@pytest.mark.asyncio
async def test_get_common_parameters(mock_session_env):
result = await common_parameters()
assert result.openai_chat_model == | "gpt-4o-mini" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_dependencies.py | test_get_common_parameters_openai | assert | string_literal | 9 | import pytest
from fastapi_app.dependencies import common_parameters, get_azure_credential
@pytest.mark.asyncio
async def test_get_common_parameters_openai(mock_session_env_openai):
result = await common_parameters()
assert result.openai_chat_model == | "gpt-3.5-turbo" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_dependencies.py | test_get_common_parameters_ollama | assert | string_literal | 10 | import pytest
from fastapi_app.dependencies import common_parameters, get_azure_credential
@pytest.mark.asyncio
async def test_get_common_parameters_ollama(mock_session_env_ollama):
result = await common_parameters()
assert result.openai_chat_model == "llama3.1"
assert result.openai_embed_model == | "nomic-embed-text" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_dependencies.py | test_get_common_parameters | assert | string_literal | 10 | import pytest
from fastapi_app.dependencies import common_parameters, get_azure_credential
@pytest.mark.asyncio
async def test_get_common_parameters(mock_session_env):
result = await common_parameters()
assert result.openai_chat_model == "gpt-4o-mini"
assert result.openai_embed_model == | "text-embedding-3-large" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_embeddings.py | test_compute_text_embedding | assert | complex_expr | 17 | import pytest
from fastapi_app.embeddings import compute_text_embedding
from fastapi_app.openai_clients import create_openai_embed_client
from tests.data import test_data
@pytest.mark.asyncio
async def test_compute_text_embedding(mock_azure_credential, mock_openai_embedding):
openai_embed_client = await create_op... | test_data.embeddings | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_frontend_routes.py | test_index | assert | numeric_literal | 15 | import os
import pytest
@pytest.mark.asyncio
async def test_index(test_client):
"""test the index route"""
response = test_client.get("/")
html_index_file_path = "src/backend/static/index.html"
with open(html_index_file_path, "rb") as f:
html_index_file = f.read()
assert response.status... | 200 | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_frontend_routes.py | test_assets_non_existent_404 | assert | numeric_literal | 11 | import os
import pytest
@pytest.mark.asyncio
async def test_assets_non_existent_404(test_client):
"""test the assets route with a non-existent file"""
response = test_client.get("/assets/manifest.json")
assert response.status_code == | 404 | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_frontend_routes.py | test_assets_non_existent_404 | assert | string_literal | 13 | import os
import pytest
@pytest.mark.asyncio
async def test_assets_non_existent_404(test_client):
"""test the assets route with a non-existent file"""
response = test_client.get("/assets/manifest.json")
assert response.status_code == 404
assert response.headers["Content-Type"] == "application/json"
... | "22" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_frontend_routes.py | test_index | assert | complex_expr | 18 | import os
import pytest
@pytest.mark.asyncio
async def test_index(test_client):
"""test the index route"""
response = test_client.get("/")
html_index_file_path = "src/backend/static/index.html"
with open(html_index_file_path, "rb") as f:
html_index_file = f.read()
assert response.status_... | response.content | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_frontend_routes.py | test_assets_non_existent_404 | assert | string_literal | 12 | import os
import pytest
@pytest.mark.asyncio
async def test_assets_non_existent_404(test_client):
"""test the assets route with a non-existent file"""
response = test_client.get("/assets/manifest.json")
assert response.status_code == 404
assert response.headers["Content-Type"] == | "application/json" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_frontend_routes.py | test_assets | assert | func_call | 18 | import os
import pytest
@pytest.mark.asyncio
async def test_assets(test_client):
"""test the assets route with an existing file"""
assets_dir_path = "src/backend/static/assets"
assets_file_path = os.listdir(assets_dir_path)[0]
with open(os.path.join(assets_dir_path, assets_file_path), "rb") as f:
... | str(len(assets_file)) | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_frontend_routes.py | test_favicon | assert | func_call | 16 | import os
import pytest
@pytest.mark.asyncio
async def test_favicon(test_client):
"""test the favicon route"""
response = test_client.get("/favicon.ico")
favicon_file_path = "src/backend/static/favicon.ico"
with open(favicon_file_path, "rb") as f:
favicon_file = f.read()
assert response.... | str(len(favicon_file)) | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_frontend_routes.py | test_index | assert | func_call | 17 | import os
import pytest
@pytest.mark.asyncio
async def test_index(test_client):
"""test the index route"""
response = test_client.get("/")
html_index_file_path = "src/backend/static/index.html"
with open(html_index_file_path, "rb") as f:
html_index_file = f.read()
assert response.status_... | str(len(html_index_file)) | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_frontend_routes.py | test_index | assert | string_literal | 16 | import os
import pytest
@pytest.mark.asyncio
async def test_index(test_client):
"""test the index route"""
response = test_client.get("/")
html_index_file_path = "src/backend/static/index.html"
with open(html_index_file_path, "rb") as f:
html_index_file = f.read()
assert response.status_... | "text/html; charset=utf-8" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_openai_clients.py | test_create_openai_embed_client | assert | none_literal | 10 | import pytest
from fastapi_app.openai_clients import create_openai_chat_client, create_openai_embed_client
from tests.data import test_data
@pytest.mark.asyncio
async def test_create_openai_embed_client(mock_azure_credential, mock_openai_embedding):
openai_embed_client = await create_openai_embed_client(mock_azur... | None | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_openai_clients.py | test_create_openai_embed_client | assert | complex_expr | 14 | import pytest
from fastapi_app.openai_clients import create_openai_chat_client, create_openai_embed_client
from tests.data import test_data
@pytest.mark.asyncio
async def test_create_openai_embed_client(mock_azure_credential, mock_openai_embedding):
openai_embed_client = await create_openai_embed_client(mock_azur... | test_data.embeddings | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_openai_clients.py | test_create_openai_chat_client | assert | string_literal | 14 | import pytest
from fastapi_app.openai_clients import create_openai_chat_client, create_openai_embed_client
from tests.data import test_data
@pytest.mark.asyncio
async def test_create_openai_chat_client(mock_azure_credential, mock_openai_chatcompletion):
openai_chat_client = await create_openai_chat_client(mock_az... | "The capital of France is Paris. [Benefit_Options-2.pdf]." | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_postgres_engine.py | test_create_postgres_engine | assert | string_literal | 27 | import os
import pytest
from fastapi_app.postgres_engine import (
create_postgres_engine,
create_postgres_engine_from_args,
create_postgres_engine_from_env,
)
from tests.conftest import POSTGRES_DATABASE, POSTGRES_HOST, POSTGRES_PASSWORD, POSTGRES_SSL, POSTGRES_USERNAME
@pytest.mark.asyncio
async def tes... | "prefer" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_postgres_engine.py | test_create_postgres_engine | assert | string_literal | 23 | import os
import pytest
from fastapi_app.postgres_engine import (
create_postgres_engine,
create_postgres_engine_from_args,
create_postgres_engine_from_env,
)
from tests.conftest import POSTGRES_DATABASE, POSTGRES_HOST, POSTGRES_PASSWORD, POSTGRES_SSL, POSTGRES_USERNAME
@pytest.mark.asyncio
async def tes... | "localhost" | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_postgres_engine.py | test_create_postgres_engine | assert | complex_expr | 24 | import os
import pytest
from fastapi_app.postgres_engine import (
create_postgres_engine,
create_postgres_engine_from_args,
create_postgres_engine_from_env,
)
from tests.conftest import POSTGRES_DATABASE, POSTGRES_HOST, POSTGRES_PASSWORD, POSTGRES_SSL, POSTGRES_USERNAME
@pytest.mark.asyncio
async def tes... | os.environ["POSTGRES_USERNAME"] | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_postgres_engine.py | test_create_postgres_engine | assert | complex_expr | 25 | import os
import pytest
from fastapi_app.postgres_engine import (
create_postgres_engine,
create_postgres_engine_from_args,
create_postgres_engine_from_env,
)
from tests.conftest import POSTGRES_DATABASE, POSTGRES_HOST, POSTGRES_PASSWORD, POSTGRES_SSL, POSTGRES_USERNAME
@pytest.mark.asyncio
async def tes... | os.environ["POSTGRES_DATABASE"] | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_postgres_engine.py | test_create_postgres_engine | assert | func_call | 26 | import os
import pytest
from fastapi_app.postgres_engine import (
create_postgres_engine,
create_postgres_engine_from_args,
create_postgres_engine_from_env,
)
from tests.conftest import POSTGRES_DATABASE, POSTGRES_HOST, POSTGRES_PASSWORD, POSTGRES_SSL, POSTGRES_USERNAME
@pytest.mark.asyncio
async def tes... | os.environ.get("POSTGRES_PASSWORD") | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_postgres_searcher.py | test_postgres_searcher_search_empty_text_search | assert | collection | 9 | import pytest
from fastapi_app.api_models import ItemPublic
from tests.data import test_data
@pytest.mark.asyncio
async def test_postgres_searcher_search_empty_text_search(postgres_searcher):
assert await postgres_searcher.search("", [], 5, None) == | [] | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_postgres_searcher.py | test_postgres_build_filter_clause_without_filters | assert | collection | 8 | import pytest
from fastapi_app.api_models import ItemPublic
from tests.data import test_data
def test_postgres_build_filter_clause_without_filters(postgres_searcher):
assert postgres_searcher.build_filter_clause(None) == | ("", "") | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_postgres_searcher.py | test_postgres_build_filter_clause_with_filters | assert | collection | 8 | import pytest
from fastapi_app.api_models import ItemPublic
from tests.data import test_data
def test_postgres_build_filter_clause_with_filters(postgres_searcher):
assert postgres_searcher.build_filter_clause([{"column": "id", "comparison_operator": "=", "value": 1}]) == | ( "WHERE id = 1", "AND id = 1", ) | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
Azure-Samples/rag-postgres-openai-python | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | train | train | tests/test_postgres_searcher.py | test_postgres_searcher_search | assert | func_call | 9 | import pytest
from fastapi_app.api_models import ItemPublic
from tests.data import test_data
@pytest.mark.asyncio
async def test_postgres_searcher_search(postgres_searcher):
assert (await postgres_searcher.search(test_data.name, test_data.embeddings, 5, None))[0].to_dict() == | ItemPublic( **test_data.model_dump() ).model_dump() | 1023c8b6481e99968246f0da70fa556309a47a2e | 7 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/conftest.py | raw | assert | string_literal | 42 | import glob
import os
import platform
from hashlib import md5
from pathlib import Path
from typing import Generator
from zipfile import ZipFile
import pytest
from mss import mss
def _no_warnings(recwarn: pytest.WarningsRecorder) -> Generator:
"""Fail on warning."""
yield
warnings = [f"{warning.filename}... | "125696266e2a8f5240f6bc17e4df98c6" | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_bgra_to_rgb.py | test_bad_length | pytest.raises | complex_expr | 9 | import pytest
from mss.base import ScreenShot
def test_bad_length() -> None:
data = bytearray(b"789c626001000000ffff030000060005")
image = ScreenShot.from_size(data, 1024, 768)
with pytest.raises( | ValueError, match="attempt to assign") | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_find_monitors.py | test_dimensions | assert | numeric_literal | 9 | import os
from mss import mss
def test_dimensions() -> None:
with mss(display=os.getenv("DISPLAY")) as sct:
mon = sct.monitors[1]
assert mon["width"] > | 0 | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_find_monitors.py | test_keys_monitor_1 | assert | variable | 9 | import os
from mss import mss
def test_keys_monitor_1() -> None:
with mss(display=os.getenv("DISPLAY")) as sct:
mon1 = sct.monitors[1]
assert "top" in | mon1 | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_find_monitors.py | test_keys_aio | assert | variable | 9 | import os
from mss import mss
def test_keys_aio() -> None:
with mss(display=os.getenv("DISPLAY")) as sct:
all_monitors = sct.monitors[0]
assert "top" in | all_monitors | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_get_pixels.py | test_get_pixel | assert | numeric_literal | 14 | import itertools
import os
import pytest
from mss import mss
from mss.base import ScreenShot
from mss.exception import ScreenShotError
def test_get_pixel(raw: bytes) -> None:
image = ScreenShot.from_size(bytearray(raw), 1024, 768)
assert image.width == 1024
assert image.height == | 768 | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_get_pixels.py | test_grab_part_of_screen | assert | numeric_literal | 17 | import itertools
import os
import pytest
from mss import mss
from mss.base import ScreenShot
from mss.exception import ScreenShotError
def test_grab_part_of_screen(pixel_ratio: int) -> None:
with mss(display=os.getenv("DISPLAY")) as sct:
for width, height in itertools.product(range(1, 42), range(1, 42)):... | 160 | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_get_pixels.py | test_get_pixel | assert | numeric_literal | 13 | import itertools
import os
import pytest
from mss import mss
from mss.base import ScreenShot
from mss.exception import ScreenShotError
def test_get_pixel(raw: bytes) -> None:
image = ScreenShot.from_size(bytearray(raw), 1024, 768)
assert image.width == | 1024 | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_get_pixels.py | test_get_pixel | assert | collection | 19 | import itertools
import os
import pytest
from mss import mss
from mss.base import ScreenShot
from mss.exception import ScreenShotError
def test_get_pixel(raw: bytes) -> None:
image = ScreenShot.from_size(bytearray(raw), 1024, 768)
assert image.width == 1024
assert image.height == 768
assert len(image... | (0, 0, 0) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_get_pixels.py | test_grab_part_of_screen | assert | complex_expr | 19 | import itertools
import os
import pytest
from mss import mss
from mss.base import ScreenShot
from mss.exception import ScreenShotError
def test_grab_part_of_screen(pixel_ratio: int) -> None:
with mss(display=os.getenv("DISPLAY")) as sct:
for width, height in itertools.product(range(1, 42), range(1, 42)):... | width * pixel_ratio | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_get_pixels.py | test_grab_part_of_screen | assert | complex_expr | 20 | import itertools
import os
import pytest
from mss import mss
from mss.base import ScreenShot
from mss.exception import ScreenShotError
def test_grab_part_of_screen(pixel_ratio: int) -> None:
with mss(display=os.getenv("DISPLAY")) as sct:
for width, height in itertools.product(range(1, 42), range(1, 42)):... | height * pixel_ratio | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_gnu_linux.py | test_missing_fast_function_for_monitor_details_retrieval | assert | collection | 31 | import platform
from collections.abc import Generator
from unittest.mock import Mock, patch
import pytest
import mss
import mss.linux
from mss.base import MSSBase
from mss.exception import ScreenShotError
pyvirtualdisplay = pytest.importorskip("pyvirtualdisplay")
PYPY = platform.python_implementation() == "PyPy"
W... | {0} | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_gnu_linux.py | test_with_cursor | assert | collection | 40 | import platform
from collections.abc import Generator
from unittest.mock import Mock, patch
import pytest
import mss
import mss.linux
from mss.base import MSSBase
from mss.exception import ScreenShotError
pyvirtualdisplay = pytest.importorskip("pyvirtualdisplay")
PYPY = platform.python_implementation() == "PyPy"
W... | {0, 255} | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_gnu_linux.py | test_bad_display_structure | pytest.raises | variable | 28 | import platform
from collections.abc import Generator
from unittest.mock import Mock, patch
import pytest
import mss
import mss.linux
from mss.base import MSSBase
from mss.exception import ScreenShotError
pyvirtualdisplay = pytest.importorskip("pyvirtualdisplay")
PYPY = platform.python_implementation() == "PyPy"
W... | TypeError) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_gnu_linux.py | test_arg_display | pytest.raises | variable | 31 | import platform
from collections.abc import Generator
from unittest.mock import Mock, patch
import pytest
import mss
import mss.linux
from mss.base import MSSBase
from mss.exception import ScreenShotError
pyvirtualdisplay = pytest.importorskip("pyvirtualdisplay")
PYPY = platform.python_implementation() == "PyPy"
W... | ScreenShotError) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_gnu_linux.py | test_factory_systems | pytest.raises | collection | 41 | import platform
from collections.abc import Generator
from unittest.mock import Mock, patch
import pytest
import mss
import mss.linux
from mss.base import MSSBase
from mss.exception import ScreenShotError
pyvirtualdisplay = pytest.importorskip("pyvirtualdisplay")
PYPY = platform.python_implementation() == "PyPy"
W... | (ScreenShotError, ValueError)) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_gnu_linux.py | test_factory_systems | pytest.raises | complex_expr | 47 | import platform
from collections.abc import Generator
from unittest.mock import Mock, patch
import pytest
import mss
import mss.linux
from mss.base import MSSBase
from mss.exception import ScreenShotError
pyvirtualdisplay = pytest.importorskip("pyvirtualdisplay")
PYPY = platform.python_implementation() == "PyPy"
W... | ImportError, match="cannot import name 'WINFUNCTYPE'") | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_entry_point_with_no_argument | assert | numeric_literal | 29 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | 0 | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_thread_safety | assert | numeric_literal | 46 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | 2 | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_entry_point_error | assert | numeric_literal | 31 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | 1 | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | main | assert | variable | 24 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | ret | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_grab_with_tuple | assert | complex_expr | 39 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | im2.pos | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_grab_with_tuple | assert | complex_expr | 40 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | im2.rgb | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_grab_with_tuple | assert | complex_expr | 38 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | im2.size | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_repr | assert | func_call | 32 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | repr(ref) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_incomplete_class | pytest.raises | variable | 23 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | TypeError) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_entry_point_with_no_argument | pytest.raises | variable | 26 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | SystemExit) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_entry_point_with_no_argument | assert | complex_expr | 33 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | captured.out | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_factory | pytest.raises | variable | 28 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | ScreenShotError) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_grab_with_tuple | assert | collection | 33 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | (width * pixel_ratio, height * pixel_ratio) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_implementation.py | test_factory | assert | string_literal | 33 | from __future__ import annotations
import os
import os.path
import platform
import sys
from datetime import datetime
from typing import TYPE_CHECKING
from unittest.mock import Mock, patch
import pytest
import mss
import mss.tools
from mss.__main__ import main as entry_point
from mss.base import MSSBase
from mss.exce... | "System 'chuck norris' not (yet?) implemented." | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_leaks.py | test_resource_leaks | assert | variable | 112 | import os
import platform
from typing import Callable
import pytest
import mss
OS = platform.system().lower()
PID = os.getpid()
def get_opened_socket() -> int:
"""GNU/Linux: a way to get the opened sockets count.
It will be used to check X server connections are well closed.
"""
import subprocess
... | allocated_resources | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_macos.py | test_repr | assert | func_call | 18 | import ctypes.util
import platform
import pytest
import mss
from mss.exception import ScreenShotError
import mss.darwin
def test_repr() -> None:
# CGPoint
point = mss.darwin.CGPoint(2.0, 1.0)
ref1 = mss.darwin.CGPoint()
ref1.x = 2.0
ref1.y = 1.0
assert repr(point) == | repr(ref1) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_macos.py | test_repr | assert | func_call | 25 | import ctypes.util
import platform
import pytest
import mss
from mss.exception import ScreenShotError
import mss.darwin
def test_repr() -> None:
# CGPoint
point = mss.darwin.CGPoint(2.0, 1.0)
ref1 = mss.darwin.CGPoint()
ref1.x = 2.0
ref1.y = 1.0
assert repr(point) == repr(ref1)
# CGSize... | repr(ref2) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_macos.py | test_repr | assert | func_call | 34 | import ctypes.util
import platform
import pytest
import mss
from mss.exception import ScreenShotError
import mss.darwin
def test_repr() -> None:
# CGPoint
point = mss.darwin.CGPoint(2.0, 1.0)
ref1 = mss.darwin.CGPoint()
ref1.x = 2.0
ref1.y = 1.0
assert repr(point) == repr(ref1)
# CGSize... | repr(ref3) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_macos.py | test_implementation | pytest.raises | variable | 18 | import ctypes.util
import platform
import pytest
import mss
from mss.exception import ScreenShotError
import mss.darwin
def test_implementation(monkeypatch: pytest.MonkeyPatch) -> None:
# No `CoreGraphics` library
version = float(".".join(platform.mac_ver()[0].split(".")[:2]))
if version < 10.16:
... | ScreenShotError) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_macos.py | test_implementation | assert | complex_expr | 31 | import ctypes.util
import platform
import pytest
import mss
from mss.exception import ScreenShotError
import mss.darwin
def test_implementation(monkeypatch: pytest.MonkeyPatch) -> None:
# No `CoreGraphics` library
version = float(".".join(platform.mac_ver()[0].split(".")[:2]))
if version < 10.16:
... | modified["width"] | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_macos.py | test_implementation | assert | complex_expr | 30 | import ctypes.util
import platform
import pytest
import mss
from mss.exception import ScreenShotError
import mss.darwin
def test_implementation(monkeypatch: pytest.MonkeyPatch) -> None:
# No `CoreGraphics` library
version = float(".".join(platform.mac_ver()[0].split(".")[:2]))
if version < 10.16:
... | modified["height"] | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_save.py | test_output_format_simple | assert | string_literal | 12 | import os.path
from datetime import datetime
import pytest
from mss import mss
def test_output_format_simple() -> None:
with mss(display=os.getenv("DISPLAY")) as sct:
filename = sct.shot(mon=1, output="mon-{mon}.png")
assert filename == | "mon-1.png" | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_save.py | test_output_format_positions_and_sizes | assert | func_call | 13 | import os.path
from datetime import datetime
import pytest
from mss import mss
def test_output_format_positions_and_sizes() -> None:
fmt = "sct-{top}x{left}_{width}x{height}.png"
with mss(display=os.getenv("DISPLAY")) as sct:
filename = sct.shot(mon=1, output=fmt)
assert filename == | fmt.format(**sct.monitors[1]) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_save.py | test_output_format_date_custom | assert | func_call | 13 | import os.path
from datetime import datetime
import pytest
from mss import mss
def test_output_format_date_custom() -> None:
fmt = "sct_{date:%Y-%m-%d}.png"
with mss(display=os.getenv("DISPLAY")) as sct:
filename = sct.shot(mon=1, output=fmt)
assert filename == | fmt.format(date=datetime.now(tz=UTC)) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_setup.py | test_sdist | assert | variable | 21 | import platform
import tarfile
from subprocess import STDOUT, check_call, check_output
from zipfile import ZipFile
import pytest
from mss import __version__
pytest.importorskip("build")
pytest.importorskip("twine")
SDIST = "python -m build --sdist".split()
WHEEL = "python -m build --wheel".split()
CHECK = "twine ch... | output | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_setup.py | test_sdist | assert | func_call | 22 | import platform
import tarfile
from subprocess import STDOUT, check_call, check_output
from zipfile import ZipFile
import pytest
from mss import __version__
pytest.importorskip("build")
pytest.importorskip("twine")
SDIST = "python -m build --sdist".split()
WHEEL = "python -m build --wheel".split()
CHECK = "twine ch... | output.lower() | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_setup.py | test_wheel | assert | collection | 29 | import platform
import tarfile
from subprocess import STDOUT, check_call, check_output
from zipfile import ZipFile
import pytest
from mss import __version__
pytest.importorskip("build")
pytest.importorskip("twine")
SDIST = "python -m build --sdist".split()
WHEEL = "python -m build --wheel".split()
CHECK = "twine ch... | [ f"mss-{__version__}.dist-info/METADATA", f"mss-{__version__}.dist-info/RECORD", f"mss-{__version__}.dist-info/WHEEL", f"mss-{__version__}.dist-info/entry_points.txt", f"mss-{__version__}.dist-info/licenses/LICENSE.txt", "mss/__init__.py", "mss/__main__.py", "mss/base.py", "mss/darwin.py", "mss/exception.py", "mss/fac... | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_tools.py | test_output_raw_bytes | assert | variable | 19 | import hashlib
import os.path
import zlib
import pytest
from mss import mss
from mss.tools import to_png
WIDTH = 10
HEIGHT = 10
MD5SUM = "055e615b74167c9bdfea16a00539450c"
def test_output_raw_bytes() -> None:
data = b"rgb" * WIDTH * HEIGHT
raw = to_png(data, (WIDTH, HEIGHT))
assert isinstance(raw, bytes... | MD5SUM | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_tools.py | test_compression_levels | assert | variable | 35 | import hashlib
import os.path
import zlib
import pytest
from mss import mss
from mss.tools import to_png
WIDTH = 10
HEIGHT = 10
MD5SUM = "055e615b74167c9bdfea16a00539450c"
@pytest.mark.parametrize(
("level", "checksum"),
[
(0, "f37123dbc08ed7406d933af11c42563e"),
(1, "7d5dcf2a2224445daf19d6d... | checksum | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_tools.py | test_bad_compression_level | pytest.raises | complex_expr | 16 | import hashlib
import os.path
import zlib
import pytest
from mss import mss
from mss.tools import to_png
WIDTH = 10
HEIGHT = 10
MD5SUM = "055e615b74167c9bdfea16a00539450c"
def test_bad_compression_level() -> None:
with mss(compression_level=42, display=os.getenv("DISPLAY")) as sct, pytest.raises( | zlib.error) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_windows.py | test_region_not_caching | assert | variable | 25 | from __future__ import annotations
import threading
import pytest
import mss
from mss.exception import ScreenShotError
def test_region_not_caching() -> None:
"""The region to grab is not bad cached previous grab."""
grab1 = mss.mss()
grab2 = mss.mss()
assert isinstance(grab1, mss.windows.MSS) # Fo... | bmp2 | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
BoboTiG/python-mss | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | train | train | src/tests/test_windows.py | test_implementation | pytest.raises | variable | 17 | from __future__ import annotations
import threading
import pytest
import mss
from mss.exception import ScreenShotError
def test_implementation(monkeypatch: pytest.MonkeyPatch) -> None:
# Test bad data retrieval
with mss.mss() as sct:
assert isinstance(sct, mss.windows.MSS) # For Mypy
monke... | ScreenShotError) | 1b22eef6acc11a9cf306982a301195da40b1b464 | 87 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.