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
sammchardy/python-binance
import os import pytest proxies = {} proxy = os.getenv("PROXY") def test_papi_ping_sync(client): ping_response = client.papi_ping() assert ping_response is not
None
assert
none_literal
tests/test_ping.py
test_papi_ping_sync
11
null
sammchardy/python-binance
from binance import ( AsyncClient, Client, DepthCacheManager, OptionsDepthCacheManager, ThreadedDepthCacheManager, FuturesDepthCacheManager, BinanceSocketManager, ThreadedWebsocketManager, BinanceSocketType, KeepAliveWebsocket, ReconnectingWebsocket ) def test_version(): ...
None
assert
none_literal
tests/test_init.py
test_version
19
null
sammchardy/python-binance
from datetime import datetime import pytest from .test_order import assert_contract_order from .test_get_order_book import assert_ob pytestmark = [pytest.mark.futures, pytest.mark.asyncio] async def close_all_futures_positions(futuresClientAsync): # Get all open positions positions = await futuresClientAsync...
order
assert
variable
tests/test_async_client_futures.py
test_futures_create_algo_order_async
559
null
sammchardy/python-binance
from binance.ws.depthcache import DepthCache from decimal import Decimal import pytest TEST_SYMBOL = "BNBBTC" def fresh_cache(): return DepthCache(TEST_SYMBOL, Decimal) def test_add_bids(fresh_cache): """Verify basic functionality for adding a bid to the cache""" high_bid = [0.111, 489] mid_bid = [0....
3
assert
numeric_literal
tests/test_depth_cache.py
test_add_bids
23
null
sammchardy/python-binance
import requests_mock import json from binance.client import Client import re client = Client(api_key="api_key", api_secret="api_secret", ping=False) def test_futures_account_balance(): with requests_mock.mock() as m: url_matcher = re.compile(r"https:\/\/fapi.binance.com\/fapi\/v3\/balance\?.+") m....
"/fapi/v3/balance"
assert
string_literal
tests/test_futures.py
test_futures_account_balance
84
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
None
assert
none_literal
tests/test_reconnecting_websocket.py
test_before_reconnect
94
null
sammchardy/python-binance
import pytest from binance.client import Client from binance.async_client import AsyncClient from binance.exceptions import BinanceRegionException class TestBinanceRegionException: def test_exception_attributes(self): """Test that exception has correct attributes.""" exc = BinanceRegionException("...
"com"
assert
string_literal
tests/test_region_exception.py
test_exception_attributes
TestBinanceRegionException
16
null
sammchardy/python-binance
import sys import pytest from binance.client import Client from binance.exceptions import BinanceAPIException, BinanceRequestException from .conftest import proxies, api_key, api_secret, testnet, call_method_and_assert_uri_contains def test_time_unit_microseconds(): micro_client = Client( api_key, ...
16
assert
numeric_literal
tests/test_client.py
test_time_unit_microseconds
219
null
sammchardy/python-binance
import sys import pytest from binance.client import Client from binance.exceptions import BinanceAPIException, BinanceRequestException from .conftest import proxies, api_key, api_secret, testnet, call_method_and_assert_uri_contains def test_handle_response(client): # Test successful JSON response mock_response...
BinanceAPIException)
pytest.raises
variable
tests/test_client.py
test_handle_response
268
null
sammchardy/python-binance
import sys import pytest from binance.client import Client from .conftest import proxies, api_key, api_secret, testnet from .test_get_order_book import assert_ob pytestmark = [pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+")] def test_ws_get_order_book(client): orderbook = clie...
orderbook)
assert_*
variable
tests/test_client_ws_api.py
test_ws_get_order_book
11
null
sammchardy/python-binance
from binance.client import Client import pytest import requests_mock client = Client("api_key", "api_secret", ping=False) def test_historical_kline_generator(): """Test kline historical generator""" first_available_res = [ [ 1500004800000, "0.00005000", "0.00005300...
0
assert
numeric_literal
tests/test_historical_klines.py
test_historical_kline_generator
240
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
"wss://test.url"
assert
string_literal
tests/test_reconnecting_websocket.py
test_init
22
null
sammchardy/python-binance
import logging import pytest def test_websocket_logger_exists(): """Test that WebSocket loggers can be configured""" # Test main WebSocket logger ws_logger = logging.getLogger("binance.ws") assert ws_logger is not
None
assert
none_literal
tests/test_websocket_verbose.py
test_websocket_logger_exists
11
null
sammchardy/python-binance
import logging import pytest def test_websocket_logger_level_configuration(): """Test that WebSocket logger levels can be set""" ws_logger = logging.getLogger("binance.ws.test_config") # Set to DEBUG ws_logger.setLevel(logging.DEBUG) assert ws_logger.level ==
logging.DEBUG
assert
complex_expr
tests/test_websocket_verbose.py
test_websocket_logger_level_configuration
32
null
sammchardy/python-binance
import asyncio import pytest import pytest_asyncio from binance import BinanceSocketManager async def socket_manager(clientAsync): """Create a BinanceSocketManager using the clientAsync fixture from conftest.""" return BinanceSocketManager(clientAsync) class TestUserSocketArchitecture: @pytest.mark.asyn...
user_socket._queue
assert
complex_expr
tests/test_user_socket_integration.py
test_user_socket_queue_registered_with_ws_api
TestUserSocketArchitecture
84
null
sammchardy/python-binance
import json import sys import pytest import asyncio from binance import AsyncClient from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from binance.ws.constants import WSListenerState from .test_get_order_book import assert_ob from .conftest import proxy @pytest.mark.asyncio async def...
order_book)
assert_*
variable
tests/test_ws_api.py
test_connection_handling
81
null
sammchardy/python-binance
import logging import pytest @pytest.mark.asyncio() async def test_binance_socket_manager_verbose(): """Test that BinanceSocketManager can be initialized with verbose mode""" from binance import AsyncClient, BinanceSocketManager client = AsyncClient() # Test with verbose=True bm_verbose = Binance...
False
assert
bool_literal
tests/test_websocket_verbose.py
test_binance_socket_manager_verbose
76
null
sammchardy/python-binance
import pytest import sys from binance.async_client import AsyncClient from .conftest import proxy, api_key, api_secret, testnet from binance.exceptions import BinanceAPIException, BinanceRequestException from aiohttp import ClientResponse, hdrs from aiohttp.helpers import TimerNoop from yarl import URL pytestmark = [...
None
assert
none_literal
tests/test_async_client.py
test_clientAsync_initialization
15
null
sammchardy/python-binance
import sys from binance import BinanceSocketManager import pytest from binance.async_client import AsyncClient from .conftest import proxy, api_key, api_secret, testnet @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") @pytest.mark.asyncio async def test_socket_stopped_on_aexit(cli...
{}
assert
collection
tests/test_streams.py
test_socket_stopped_on_aexit
16
null
sammchardy/python-binance
import sys import pytest import logging from binance import BinanceSocketManager pytestmark = [ pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+"), pytest.mark.asyncio ] logger = logging.getLogger(__name__) OPTION_SYMBOL = "BTC-251226-60000-P" UNDERLYING_SYMBOL = "BTC" EXPIR...
'24hrTicker'
assert
string_literal
tests/test_streams_options.py
test_options_ticker
30
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
{"test": "data"}
assert
collection
tests/test_reconnecting_websocket.py
test_recv_message
83
null
sammchardy/python-binance
from binance.ws.depthcache import DepthCache from decimal import Decimal import pytest TEST_SYMBOL = "BNBBTC" def fresh_cache(): return DepthCache(TEST_SYMBOL, Decimal) def test_add_asks(fresh_cache): """Verify basic functionality for adding an ask to the cache""" high_ask = [0.111, 489] mid_ask = [0...
sorted(asks)
assert
func_call
tests/test_depth_cache.py
test_add_asks
46
null
sammchardy/python-binance
import pytest import asyncio import websockets from binance.ws.threaded_stream import ThreadedApiManager from unittest.mock import Mock @pytest.mark.asyncio async def test_initialization(): """Test that manager initializes with correct parameters""" manager = ThreadedApiManager( api_key="test_key", ...
{}
assert
collection
tests/test_threaded_stream.py
test_initialization
43
null
sammchardy/python-binance
from binance import BinanceSocketManager, AsyncClient import pytest from .conftest import proxy def assert_message(msg): assert msg["stream"] == "!ticker@arr" assert len(msg["data"]) > 0 @pytest.mark.asyncio() async def test_ticker_socket(): client = await AsyncClient.create(testnet=True, https_proxy=prox...
res)
assert_*
variable
tests/test_socket_manager.py
test_ticker_socket
21
null
sammchardy/python-binance
import pytest import sys from binance.async_client import AsyncClient from .conftest import proxy, api_key, api_secret, testnet from binance.exceptions import BinanceAPIException, BinanceRequestException from aiohttp import ClientResponse, hdrs from aiohttp.helpers import TimerNoop from yarl import URL pytestmark = [...
{"key": "value"}
assert
collection
tests/test_async_client.py
test_handle_response
259
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
{"key": "value"}
assert
collection
tests/test_reconnecting_websocket.py
test_json_loads
40
null
sammchardy/python-binance
import pytest import sys from binance.exceptions import BinanceAPIException from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") def test_ws_futures_create_cancel_algo_order(futuresClient): """...
order["algoId"]
assert
complex_expr
tests/test_client_ws_futures_requests.py
test_ws_futures_create_cancel_algo_order
116
null
sammchardy/python-binance
from binance import BinanceSocketManager, AsyncClient import pytest from .conftest import proxy def assert_message(msg): assert msg["stream"] == "!ticker@arr" assert len(msg["data"]) >
0
assert
numeric_literal
tests/test_socket_manager.py
assert_message
8
null
sammchardy/python-binance
import pytest import sys from binance.exceptions import BinanceAPIException from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") def test_ws_futures_create_cancel_algo_order(futuresClient): """...
"CONDITIONAL"
assert
string_literal
tests/test_client_ws_futures_requests.py
test_ws_futures_create_cancel_algo_order
109
null
sammchardy/python-binance
import pytest import logging from binance.client import Client from binance.async_client import AsyncClient def test_client_non_verbose_initialization(): """Test that Client defaults to non-verbose mode""" client = Client(verbose=False, ping=False) assert client.verbose is
False
assert
bool_literal
tests/test_verbose_mode.py
test_client_non_verbose_initialization
20
null
sammchardy/python-binance
import asyncio import pytest import sys from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") @pytest.mark.asynci...
order)
assert_*
variable
tests/test_async_client_ws_futures_requests.py
test_ws_futures_create_get_edit_cancel_order_with_orjson
78
null
sammchardy/python-binance
from binance.ws.depthcache import DepthCache from decimal import Decimal import pytest TEST_SYMBOL = "BNBBTC" def fresh_cache(): return DepthCache(TEST_SYMBOL, Decimal) def test_add_bids(fresh_cache): """Verify basic functionality for adding a bid to the cache""" high_bid = [0.111, 489] mid_bid = [0....
sorted(bids, reverse=True)
assert
func_call
tests/test_depth_cache.py
test_add_bids
25
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
"JSONDecodeError"
assert
string_literal
tests/test_reconnecting_websocket.py
test_recieve_invalid_json
142
null
sammchardy/python-binance
import sys import pytest from binance.client import Client from binance.exceptions import BinanceAPIException, BinanceRequestException from .conftest import proxies, api_key, api_secret, testnet, call_method_and_assert_uri_contains def test_time_unit_milloseconds(): milli_client = Client( api_key, ...
13
assert
numeric_literal
tests/test_client.py
test_time_unit_milloseconds
233
null
sammchardy/python-binance
import asyncio import pytest import sys from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") @pytest.mark.asynci...
"CONDITIONAL"
assert
string_literal
tests/test_async_client_ws_futures_requests.py
test_ws_futures_create_cancel_algo_order
198
null
sammchardy/python-binance
import pytest from binance.client import Client from binance.async_client import AsyncClient from binance.exceptions import BinanceRegionException class TestBinanceRegionException: def test_exception_attributes(self): """Test that exception has correct attributes.""" exc = BinanceRegionException("...
"us"
assert
string_literal
tests/test_region_exception.py
test_exception_attributes
TestBinanceRegionException
15
null
sammchardy/python-binance
import pytest import sys from binance.async_client import AsyncClient from .conftest import proxy, api_key, api_secret, testnet from binance.exceptions import BinanceAPIException, BinanceRequestException from aiohttp import ClientResponse, hdrs from aiohttp.helpers import TimerNoop from yarl import URL pytestmark = [...
BinanceRequestException)
pytest.raises
variable
tests/test_async_client.py
test_handle_response
269
null
sammchardy/python-binance
import re import requests_mock import pytest from aioresponses import aioresponses from binance import Client, AsyncClient client = Client(api_key="api_key", api_secret="api_secret", ping=False) def test_spot_id(): with requests_mock.mock() as m: m.post("https://api.binance.com/api/v3/order", json={}, st...
"0.1"
assert
string_literal
tests/test_ids.py
test_spot_id
19
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
ReadLoopClosed)
pytest.raises
variable
tests/test_reconnecting_websocket.py
test_recv_read_loop_closed
222
null
sammchardy/python-binance
from binance import BinanceSocketManager, AsyncClient import pytest from .conftest import proxy def assert_message(msg): assert msg["stream"] ==
"!ticker@arr"
assert
string_literal
tests/test_socket_manager.py
assert_message
7
null
sammchardy/python-binance
from datetime import datetime import pytest from .test_order import assert_contract_order from .test_get_order_book import assert_ob pytestmark = [pytest.mark.futures, pytest.mark.asyncio] async def test_futures_create_get_edit_cancel_order(futuresClientAsync): ticker = await futuresClientAsync.futures_ticker(sy...
order)
assert_*
variable
tests/test_async_client_futures.py
test_futures_create_get_edit_cancel_order
164
null
sammchardy/python-binance
import pytest import asyncio import websockets from binance.ws.threaded_stream import ThreadedApiManager from unittest.mock import Mock @pytest.mark.asyncio async def test_initialization(): """Test that manager initializes with correct parameters""" manager = ThreadedApiManager( api_key="test_key", ...
{ "api_key": "test_key", "api_secret": "test_secret", "requests_params": {"timeout": 10}, "tld": "com", "testnet": True, "session_params": {"trust_env": True}, "https_proxy": None, "verbose": False, }
assert
collection
tests/test_threaded_stream.py
test_initialization
44
null
sammchardy/python-binance
import requests_mock import pytest from aioresponses import aioresponses from binance import Client, AsyncClient client = Client(api_key="api_key", api_secret="api_secret", ping=False) def test_post_headers(): with requests_mock.mock() as m: m.post("https://api.binance.com/api/v3/order", json={}, status_...
"application/x-www-form-urlencoded"
assert
string_literal
tests/test_headers.py
test_post_headers
25
null
sammchardy/python-binance
from datetime import datetime import re import pytest import requests_mock from .test_order import assert_contract_order from .test_get_order_book import assert_ob def close_all_futures_positions(futuresClient): # Get all open positions positions = futuresClient.futures_position_information(symbol="LTCUSDT") ...
algo_id
assert
variable
tests/test_client_futures.py
test_futures_get_algo_order
793
null
sammchardy/python-binance
from binance import ThreadedWebsocketManager from binance.client import Client import asyncio import time from .conftest import proxies, api_key, api_secret, proxy import pytest import sys import logging pytestmark = pytest.mark.skipif( sys.version_info <= (3, 8), reason="These tests require Python 3.8+ for pr...
0
assert
numeric_literal
tests/test_threaded_socket_manager.py
test_many_symbols_adequate_queue
122
null
sammchardy/python-binance
import json import sys import pytest import asyncio from binance import AsyncClient from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from binance.ws.constants import WSListenerState from .test_get_order_book import assert_ob from .conftest import proxy @pytest.mark.skipif(sys.versio...
"BTCUSDT"
assert
string_literal
tests/test_ws_api.py
test_ws_get_symbol_ticker
49
null
sammchardy/python-binance
import asyncio import pytest import sys from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") @pytest.mark.asynci...
order["algoId"]
assert
complex_expr
tests/test_async_client_ws_futures_requests.py
test_ws_futures_create_cancel_algo_order
205
null
sammchardy/python-binance
import pytest import asyncio import websockets from binance.ws.threaded_stream import ThreadedApiManager from unittest.mock import Mock @pytest.mark.asyncio async def test_stop(manager): """Test stopping the manager""" socket_name = "test_socket" manager._socket_running[socket_name] = True manager.st...
False
assert
bool_literal
tests/test_threaded_stream.py
test_stop
165
null
sammchardy/python-binance
import pytest import requests_mock pytestmark = pytest.mark.gift_card def test_gift_card_create_verify_and_redeem(liveClient): # create a gift card response = liveClient.gift_card_create(token="USDT", amount=1.0) assert response["data"]["referenceNo"] is not None assert response["data"]["code"] is not...
redeem_response["data"]["referenceNo"]
assert
complex_expr
tests/test_client_gift_card.py
test_gift_card_create_verify_and_redeem
46
null
sammchardy/python-binance
import pytest import sys from binance.async_client import AsyncClient from .conftest import proxy, api_key, api_secret, testnet from binance.exceptions import BinanceAPIException, BinanceRequestException from aiohttp import ClientResponse, hdrs from aiohttp.helpers import TimerNoop from yarl import URL pytestmark = [...
13
assert
numeric_literal
tests/test_async_client.py
test_time_unit_milloseconds
235
null
sammchardy/python-binance
import json import sys import pytest import asyncio from binance import AsyncClient from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from binance.ws.constants import WSListenerState from .test_get_order_book import assert_ob from .conftest import proxy @pytest.mark.asyncio async def...
len(symbols)
assert
func_call
tests/test_ws_api.py
test_multiple_requests
105
null
sammchardy/python-binance
import json import sys import pytest import asyncio from binance import AsyncClient from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from binance.ws.constants import WSListenerState from .test_get_order_book import assert_ob from .conftest import proxy @pytest.mark.asyncio async def...
result)
assert_*
variable
tests/test_ws_api.py
test_multiple_requests
107
null
sammchardy/python-binance
import pytest import pytest_asyncio from binance.client import Client from binance.async_client import AsyncClient import os import asyncio import logging from binance.ws.streams import ThreadedWebsocketManager proxies = {} proxy = os.getenv("PROXY") proxy = "http://188.245.226.105:8911" api_key = os.getenv("TEST_A...
uri
assert
variable
tests/conftest.py
call_method_and_assert_uri_contains
211
null
sammchardy/python-binance
import pytest pytestmark = [pytest.mark.gift_card, pytest.mark.asyncio] async def test_gift_card_create_verify_and_redeem(liveClientAsync): # create a gift card response = await liveClientAsync.gift_card_create(token="USDT", amount=1.0) assert response["data"]["referenceNo"] is not None assert respons...
"SUCCESS"
assert
string_literal
tests/test_async_client_gift_card copy.py
test_gift_card_create_verify_and_redeem
23
null
sammchardy/python-binance
import requests_mock import json from binance.client import Client import re client = Client(api_key="api_key", api_secret="api_secret", ping=False) def test_futures_position_information(): with requests_mock.mock() as m: url_matcher = re.compile( r"https:\/\/fapi.binance.com\/fapi\/v3\/positi...
"LTCUSDT".lower()
assert
string_literal
tests/test_futures.py
test_futures_position_information
40
null
sammchardy/python-binance
from datetime import datetime import re import pytest import requests_mock from .test_order import assert_contract_order from .test_get_order_book import assert_ob def close_all_futures_positions(futuresClient): # Get all open positions positions = futuresClient.futures_position_information(symbol="LTCUSDT") ...
True
assert
bool_literal
tests/test_client_futures.py
test_futures_create_algo_order_with_price_protect
923
null
sammchardy/python-binance
from datetime import datetime import pytest from .test_order import assert_contract_order from .test_get_order_book import assert_ob pytestmark = [pytest.mark.futures, pytest.mark.asyncio] async def close_all_futures_positions(futuresClientAsync): # Get all open positions positions = await futuresClientAsync...
True
assert
bool_literal
tests/test_async_client_futures.py
test_futures_create_algo_order_with_price_protect_async
662
null
sammchardy/python-binance
import pytest import sys from binance.exceptions import BinanceAPIException from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") def test_ws_futures_create_get_edit_cancel_order(futuresClient): ...
order)
assert_*
variable
tests/test_client_ws_futures_requests.py
test_ws_futures_create_get_edit_cancel_order
42
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
"/test"
assert
string_literal
tests/test_reconnecting_websocket.py
test_init
23
null
sammchardy/python-binance
from datetime import datetime import re import pytest import requests_mock from .test_order import assert_contract_order from .test_get_order_book import assert_ob def close_all_futures_positions(futuresClient): # Get all open positions positions = futuresClient.futures_position_information(symbol="LTCUSDT") ...
order
assert
variable
tests/test_client_futures.py
test_futures_create_algo_order
745
null
sammchardy/python-binance
import pytest import sys from binance.exceptions import BinanceAPIException def assert_ob(order_book): assert isinstance(order_book, dict) assert "lastUpdateId" in
order_book
assert
variable
tests/test_get_order_book.py
assert_ob
8
null
sammchardy/python-binance
import json import sys import pytest import asyncio from binance import AsyncClient from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from binance.ws.constants import WSListenerState from .test_get_order_book import assert_ob from .conftest import proxy @pytest.mark.asyncio async def...
None
assert
none_literal
tests/test_ws_api.py
test_connection_handling
77
null
sammchardy/python-binance
from binance.client import Client from binance.exceptions import BinanceAPIException, BinanceRequestException import pytest import requests_mock import os proxies = {} proxy = os.getenv("PROXY") client = Client("api_key", "api_secret", {"proxies": proxies}) def test_api_exception(): """Test API response Exceptio...
BinanceAPIException)
pytest.raises
variable
tests/test_api_request.py
test_api_exception
36
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
wait_time
assert
variable
tests/test_reconnecting_websocket.py
test_get_reconnect_wait
102
null
sammchardy/python-binance
import pytest import sys from binance.exceptions import BinanceAPIException def assert_ob(order_book): assert isinstance(order_book, dict) assert "lastUpdateId" in order_book assert "bids" in order_book assert "asks" in order_book assert isinstance(order_book["bids"], list) assert isinstance(o...
5
assert
numeric_literal
tests/test_get_order_book.py
test_get_order_book_with_limit
49
null
sammchardy/python-binance
from binance import ThreadedWebsocketManager from binance.client import Client import asyncio import time from .conftest import proxies, api_key, api_secret, proxy import pytest import sys import logging pytestmark = pytest.mark.skipif( sys.version_info <= (3, 8), reason="These tests require Python 3.8+ for pr...
RuntimeError, match="Binance Socket Manager failed to initialize after 5 seconds")
pytest.raises
complex_expr
tests/test_threaded_socket_manager.py
test_no_internet_connection
172
null
sammchardy/python-binance
import re import requests_mock import pytest from aioresponses import aioresponses from binance import Client, AsyncClient client = Client(api_key="api_key", api_secret="api_secret", ping=False) def test_spot_id(): with requests_mock.mock() as m: m.post("https://api.binance.com/api/v3/order", json={}, st...
"MARKET"
assert
string_literal
tests/test_ids.py
test_spot_id
18
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
str(exc_info.value)
assert
func_call
tests/test_reconnecting_websocket.py
test_recv_read_loop_closed
225
null
sammchardy/python-binance
import re import requests_mock import pytest from aioresponses import aioresponses from binance import Client, AsyncClient client = Client(api_key="api_key", api_secret="api_secret", ping=False) def test_spot_id(): with requests_mock.mock() as m: m.post("https://api.binance.com/api/v3/order", json={}, st...
"LTCUSDT"
assert
string_literal
tests/test_ids.py
test_spot_id
16
null
sammchardy/python-binance
import requests_mock import pytest from aioresponses import aioresponses from binance import Client, AsyncClient client = Client(api_key="api_key", api_secret="api_secret", ping=False) def test_post_headers_overriden(): with requests_mock.mock() as m: m.post("https://api.binance.com/api/v3/order", json={...
"myvalue"
assert
string_literal
tests/test_headers.py
test_post_headers_overriden
40
null
sammchardy/python-binance
import logging import pytest def test_combined_logging_configuration(): """Test that both REST and WebSocket logging can be configured together""" # Configure REST verbose logging from binance.client import Client # This should work without errors client = Client(verbose=True, ping=False) ass...
True
assert
bool_literal
tests/test_websocket_verbose.py
test_combined_logging_configuration
50
null
sammchardy/python-binance
import asyncio import pytest import sys from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") @pytest.mark.asynci...
order
assert
variable
tests/test_async_client_ws_futures_requests.py
test_ws_futures_create_cancel_algo_order
197
null
sammchardy/python-binance
from binance.client import Client import pytest import requests_mock client = Client("api_key", "api_secret", ping=False) def test_exact_amount(): """Test Exact amount returned""" first_available_res = [ [ 1500004800000, "0.00005000", "0.00005300", "0.0...
500
assert
numeric_literal
tests/test_historical_klines.py
test_exact_amount
70
null
sammchardy/python-binance
import pytest import requests_mock pytestmark = pytest.mark.gift_card def test_mock_gift_card_fetch_token_limit(liveClient): """Test gift card token limit endpoint with mocked response""" expected_response = { "code": "000000", "message": "success", "data": [{"coin": "BNB", "fromMin": ...
expected_response
assert
variable
tests/test_client_gift_card.py
test_mock_gift_card_fetch_token_limit
23
null
sammchardy/python-binance
import sys import pytest import logging from binance import BinanceSocketManager pytestmark = [ pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+"), pytest.mark.asyncio ] logger = logging.getLogger(__name__) OPTION_SYMBOL = "BTC-251226-60000-P" UNDERLYING_SYMBOL = "BTC" EXPIR...
'depth'
assert
string_literal
tests/test_streams_options.py
test_options_depth
82
null
sammchardy/python-binance
from binance.client import Client import pytest import requests_mock client = Client("api_key", "api_secret", ping=False) def test_historical_kline_generator(): """Test kline historical generator""" first_available_res = [ [ 1500004800000, "0.00005000", "0.00005300...
StopIteration)
pytest.raises
variable
tests/test_historical_klines.py
test_historical_kline_generator
242
null
sammchardy/python-binance
import json import sys import pytest import asyncio from binance import AsyncClient from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from binance.ws.constants import WSListenerState from .test_get_order_book import assert_ob from .conftest import proxy @pytest.mark.skipif(sys.versio...
ticker
assert
variable
tests/test_ws_api.py
test_ws_get_symbol_ticker
48
null
sammchardy/python-binance
import pytest import logging from binance.client import Client from binance.async_client import AsyncClient def test_client_verbose_initialization(): """Test that Client can be initialized with verbose mode""" client = Client(verbose=True, ping=False) assert client.verbose is
True
assert
bool_literal
tests/test_verbose_mode.py
test_client_verbose_initialization
12
null
sammchardy/python-binance
import re import requests_mock import pytest from aioresponses import aioresponses from binance import Client, AsyncClient client = Client(api_key="api_key", api_secret="api_secret", ping=False) def test_spot_id(): with requests_mock.mock() as m: m.post("https://api.binance.com/api/v3/order", json={}, st...
"BUY"
assert
string_literal
tests/test_ids.py
test_spot_id
17
null
sammchardy/python-binance
import json import sys import pytest import asyncio from binance import AsyncClient from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from binance.ws.constants import WSListenerState from .test_get_order_book import assert_ob from .conftest import proxy @pytest.mark.asyncio async def...
json.JSONDecodeError)
pytest.raises
complex_expr
tests/test_ws_api.py
test_message_handling_invalid_json
164
null
sammchardy/python-binance
import sys from binance import BinanceSocketManager import pytest from binance.async_client import AsyncClient from .conftest import proxy, api_key, api_secret, testnet @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") @pytest.mark.asyncio async def test_socket_spot_market_time_uni...
16
assert
numeric_literal
tests/test_streams.py
test_socket_spot_market_time_unit_microseconds
42
null
sammchardy/python-binance
import asyncio import pytest import sys from binance.exceptions import BinanceAPIException, BinanceWebsocketUnableToConnect from .test_get_order_book import assert_ob from .test_order import assert_contract_order @pytest.mark.skipif(sys.version_info < (3, 8), reason="websockets_proxy Python 3.8+") @pytest.mark.asynci...
len(symbols)
assert
func_call
tests/test_async_client_ws_futures_requests.py
test_concurrent_ws_futures_get_order_book
36
null
sammchardy/python-binance
import sys import pytest import gzip import json from unittest.mock import patch, create_autospec, Mock from binance.ws.reconnecting_websocket import ReconnectingWebsocket from binance.ws.constants import WSListenerState from binance.exceptions import BinanceWebsocketUnableToConnect, ReadLoopClosed from websockets impo...
json.loads(msgRecv)
assert
func_call
tests/test_reconnecting_websocket.py
test_receive_valid_json
161
null
sammchardy/python-binance
import asyncio import pytest import pytest_asyncio from binance import BinanceSocketManager async def socket_manager(clientAsync): """Create a BinanceSocketManager using the clientAsync fixture from conftest.""" return BinanceSocketManager(clientAsync) class TestUserSocketFunctionality: @pytest.mark.asy...
asyncio.TimeoutError)
pytest.raises
complex_expr
tests/test_user_socket_integration.py
test_user_socket_recv_timeout
TestUserSocketFunctionality
112
null
mohamed-chs/convoviz
from datetime import datetime from convoviz.config import YAMLConfig from convoviz.models import Conversation from convoviz.models.message import ( Message, MessageAuthor, MessageContent, MessageMetadata, ) from convoviz.renderers.markdown import replace_citations from convoviz.renderers.yaml import re...
"Sources: [^1] [^2]"
assert
string_literal
tests/test_v3_spec.py
test_replace_embedded_citations_multiple
TestCitationParsing
147
null
mohamed-chs/convoviz
import json import stat import time from pathlib import Path from zipfile import ZipFile, ZipInfo import orjson import pytest from convoviz.exceptions import InvalidZipError from convoviz.io.loaders import ( find_latest_valid_zip, find_script_export, load_collection, load_collection_from_json, loa...
"Test"
assert
string_literal
tests/test_loaders.py
test_load_wrapped_format
TestLoadCollectionFromJsonFormats
171
null
mohamed-chs/convoviz
from pathlib import Path from unittest.mock import patch import pytest from typer.testing import CliRunner from convoviz.cli import app from convoviz.config import OutputKind runner = CliRunner() def _isolate_user_config(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None: monkeypatch.setattr( "con...
mock_zip_file
assert
variable
tests/test_cli.py
test_main_with_args
36
null
mohamed-chs/convoviz
from datetime import datetime from convoviz.config import YAMLConfig from convoviz.models import Conversation from convoviz.models.message import ( Message, MessageAuthor, MessageContent, MessageMetadata, ) from convoviz.renderers.markdown import replace_citations from convoviz.renderers.yaml import re...
[ "[^1]: [S1](http://s1.com)", "[^2]: [S2](http://s2.com)", ]
assert
collection
tests/test_v3_spec.py
test_replace_embedded_citations_multiple
TestCitationParsing
148
null
mohamed-chs/convoviz
from pathlib import Path import pytest from convoviz.config import ( ALL_OUTPUTS, AuthorHeaders, ConversationConfig, ConvovizConfig, GraphConfig, MarkdownConfig, MessageConfig, OutputKind, WordCloudConfig, YAMLConfig, apply_runtime_defaults, get_default_config, get_...
True
assert
bool_literal
tests/test_config.py
test_apply_runtime_defaults_applies_input_and_font
48
null
mohamed-chs/convoviz
from pathlib import Path from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path class TestCopyAsset: def test_skip_existing_file(self, tmp_path: Path) -> None: """Test that existing files are not overwritten and new names are used.""" src_file = tmp_path / "image.png" ...
b"NEW"
assert
string_literal
tests/test_assets.py
test_skip_existing_file
TestCopyAsset
139
null
mohamed-chs/convoviz
from pathlib import Path import pytest from convoviz.exceptions import ConfigurationError from convoviz.utils import ( deep_merge_dicts, expand_path, normalize_optional_path, sanitize, validate_header, validate_writable_dir, ) class TestValidateHeader: def test_valid_h1(self) -> None: ...
True
assert
bool_literal
tests/test_utils.py
test_valid_h1
TestValidateHeader
100
null
mohamed-chs/convoviz
from pathlib import Path from convoviz.config import AuthorHeaders from convoviz.io.assets import copy_asset from convoviz.models import ( Message, MessageAuthor, MessageContent, MessageMetadata, Node, ) from convoviz.renderers.markdown import render_node def create_message_with_attachment( ms...
1
assert
numeric_literal
tests/test_attachment_renaming.py
test_render_node_renames_attachment
70
null
mohamed-chs/convoviz
from pathlib import Path from unittest.mock import patch import pytest from typer.testing import CliRunner from convoviz.cli import app from convoviz.config import OutputKind runner = CliRunner() def _isolate_user_config(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None: monkeypatch.setattr( "con...
output_dir
assert
variable
tests/test_cli.py
test_main_with_args
37
null
mohamed-chs/convoviz
from datetime import UTC, datetime from pathlib import Path from unittest.mock import patch import pytest from convoviz.analysis.wordcloud import ( _generate_and_save_wordcloud, generate_wordcloud, generate_wordclouds, load_nltk_stopwords, parse_custom_stopwords, ) from convoviz.config import Word...
[]
assert
collection
tests/test_wordcloud.py
test_generate_wordclouds_empty_collection
85
null
mohamed-chs/convoviz
from pathlib import Path import pytest from convoviz.exceptions import ConfigurationError from convoviz.utils import ( deep_merge_dicts, expand_path, normalize_optional_path, sanitize, validate_header, validate_writable_dir, ) class TestPathNormalization: def test_normalize_optional_path...
"xyz"
assert
string_literal
tests/test_utils.py
test_normalize_optional_path_expands
TestPathNormalization
165
null
mohamed-chs/convoviz
from pathlib import Path from convoviz.config import AuthorHeaders from convoviz.io.assets import copy_asset from convoviz.models import ( Message, MessageAuthor, MessageContent, MessageMetadata, Node, ) from convoviz.renderers.markdown import render_node def create_message_with_attachment( ms...
b"DATA"
assert
string_literal
tests/test_attachment_renaming.py
test_copy_asset_uses_target_name
117
null
mohamed-chs/convoviz
from pathlib import Path from convoviz.config import AuthorHeaders from convoviz.io.assets import copy_asset from convoviz.models import ( Message, MessageAuthor, MessageContent, MessageMetadata, Node, ) from convoviz.renderers.markdown import render_node def create_message_with_attachment( ms...
f"assets/{target_name}"
assert
string_literal
tests/test_attachment_renaming.py
test_copy_asset_uses_target_name
112
null
mohamed-chs/convoviz
import copy from datetime import UTC, datetime, timedelta from convoviz.models import Conversation from convoviz.models.collection import ConversationCollection from convoviz.models.message import ( Message, MessageAuthor, MessageContent, MessageMetadata, ) from convoviz.models.node import Node, build_...
0
assert
numeric_literal
tests/test_models.py
test_message_count
33
null
mohamed-chs/convoviz
from datetime import datetime from convoviz.config import YAMLConfig from convoviz.models import Conversation from convoviz.models.message import ( Message, MessageAuthor, MessageContent, MessageMetadata, ) from convoviz.renderers.markdown import replace_citations from convoviz.renderers.yaml import re...
yaml
assert
variable
tests/test_v3_spec.py
test_render_yaml_header_new_fields
TestMetadataEnrichment
215
null
mohamed-chs/convoviz
from pathlib import Path from unittest.mock import patch import pytest from typer.testing import CliRunner from convoviz.cli import app from convoviz.config import OutputKind runner = CliRunner() def _isolate_user_config(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None: monkeypatch.setattr( "con...
{ OutputKind.MARKDOWN, OutputKind.GRAPHS, OutputKind.WORDCLOUDS, }
assert
collection
tests/test_cli.py
test_outputs_flag_default_all
142
null