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
zerodha/pykiteconnect
import pytest import responses import kiteconnect.exceptions as ex @responses.activate def test_wrong_content_type(kiteconnect): rdf_data = "<rdf:Description rdf:about=''><rdfs:label>zerodha</rdfs:label></rdf:Description" responses.add( responses.GET, "%s%s" % (kiteconnect.root, kiteconnect._ro...
"Unknown Content-Type ({content_type}) with response: ({content})".format( content_type='application/rdf+xml', content=rdf_data )
assert
string_literal
tests/unit/test_exceptions.py
test_wrong_content_type
33
null
zerodha/pykiteconnect
import utils import time import warnings params = { "exchange": "NSE", "tradingsymbol": "RELIANCE", "transaction_type": "BUY", "quantity": 1 } def is_pending_order(status): """Check if the status is pending order status.""" status = status.upper() if ("COMPLETE" in status or "REJECT" in st...
to_quantity
assert
variable
tests/integration/test_connect_write.py
test_order_modify_limit_regular
332
null
zerodha/pykiteconnect
import os import json responses_path = { "base": "../mock_responses/", "user.profile": "profile.json", "user.margins": "margins.json", "user.margins.segment": "margins.json", "orders": "orders.json", "trades": "trades.json", "order.info": "order_info.json", "order.trades": "order_trade...
sample[key])
assert_*
complex_expr
tests/helpers/utils.py
assert_responses
89
null
zerodha/pykiteconnect
import utils import time import warnings params = { "exchange": "NSE", "tradingsymbol": "RELIANCE", "transaction_type": "BUY", "quantity": 1 } def is_pending_order(status): """Check if the status is pending order status.""" status = status.upper() if ("COMPLETE" in status or "REJECT" in st...
kiteconnect.PRODUCT_CO
assert
complex_expr
tests/integration/test_connect_write.py
test_place_order_co_market
236
null
zerodha/pykiteconnect
import pytest from mock import patch import responses import requests from kiteconnect import KiteConnect import kiteconnect.exceptions as ex def get_fake_token(self, route, params=None): return { "access_token": "TOKEN", "login_time": None } def get_fake_delete(self, route, params=None): ...
"TOKEN"
assert
string_literal
tests/unit/test_kite_object.py
test_generate_session
TestKiteConnectObject
74
null
zerodha/pykiteconnect
import pytest import responses import kiteconnect.exceptions as ex @responses.activate def test_wrong_json_response(kiteconnect): responses.add( responses.GET, "%s%s" % (kiteconnect.root, kiteconnect._routes["portfolio.positions"]), body="{a:b}", content_type="application/json" ...
ex.DataException)
pytest.raises
complex_expr
tests/unit/test_exceptions.py
test_wrong_json_response
16
null
zerodha/pykiteconnect
import pytest import responses import kiteconnect.exceptions as ex import utils @responses.activate def test_positions(kiteconnect): """Test positions.""" responses.add( responses.GET, "{0}{1}".format(kiteconnect.root, kiteconnect._routes["portfolio.positions"]), body=utils.get_respons...
dict
assert
variable
tests/unit/test_connect.py
test_positions
27
null
zerodha/pykiteconnect
import pytest from mock import Mock import utils import time import datetime import warnings import kiteconnect.exceptions as ex def test_orders(kiteconnect): """Test orders get.""" orders = kiteconnect.orders() assert type(orders) ==
list
assert
variable
tests/integration/test_connect_read.py
test_orders
85
null
zerodha/pykiteconnect
import utils import time import warnings params = { "exchange": "NSE", "tradingsymbol": "RELIANCE", "transaction_type": "BUY", "quantity": 1 } def is_pending_order(status): """Check if the status is pending order status.""" status = status.upper() if ("COMPLETE" in status or "REJECT" in st...
kiteconnect.PRODUCT_MIS
assert
complex_expr
tests/integration/test_connect_write.py
test_place_order_market_regular
135
null
zerodha/pykiteconnect
import os import json responses_path = { "base": "../mock_responses/", "user.profile": "profile.json", "user.margins": "margins.json", "user.margins.segment": "margins.json", "orders": "orders.json", "trades": "trades.json", "order.info": "order_info.json", "order.trades": "order_trade...
sample[0])
assert_*
complex_expr
tests/helpers/utils.py
assert_responses
84
null
zerodha/pykiteconnect
import pytest from mock import Mock import utils import time import datetime import warnings import kiteconnect.exceptions as ex def test_positions(kiteconnect): """Test positions.""" positions = kiteconnect.positions() mock_resp = utils.get_json_response("portfolio.positions")["data"] utils.assert_re...
mock_resp)
assert_*
variable
tests/integration/test_connect_read.py
test_positions
52
null
zerodha/pykiteconnect
import pytest from mock import patch import responses import requests from kiteconnect import KiteConnect import kiteconnect.exceptions as ex def get_fake_token(self, route, params=None): return { "access_token": "TOKEN", "login_time": None } def get_fake_delete(self, route, params=None): ...
None
assert
none_literal
tests/unit/test_kite_object.py
test_request_without_pooling
TestKiteConnectObject
29
null
zerodha/pykiteconnect
import pytest from mock import patch import responses import requests from kiteconnect import KiteConnect import kiteconnect.exceptions as ex def get_fake_token(self, route, params=None): return { "access_token": "TOKEN", "login_time": None } def get_fake_delete(self, route, params=None): ...
"token invalidated"
assert
string_literal
tests/unit/test_kite_object.py
test_invalidate_token
TestKiteConnectObject
83
null
zerodha/pykiteconnect
import pytest import responses import kiteconnect.exceptions as ex import utils @responses.activate def test_holdings(kiteconnect): """Test holdings.""" responses.add( responses.GET, "{0}{1}".format(kiteconnect.root, kiteconnect._routes["portfolio.holdings"]), body=utils.get_response("...
list
assert
variable
tests/unit/test_connect.py
test_holdings
42
null
zerodha/pykiteconnect
import os import json responses_path = { "base": "../mock_responses/", "user.profile": "profile.json", "user.margins": "margins.json", "user.margins.segment": "margins.json", "orders": "orders.json", "trades": "trades.json", "order.info": "order_info.json", "order.trades": "order_trade...
type(sample)
assert
func_call
tests/helpers/utils.py
assert_responses
80
null
zerodha/pykiteconnect
import pytest from mock import patch import responses import requests from kiteconnect import KiteConnect import kiteconnect.exceptions as ex def get_fake_token(self, route, params=None): return { "access_token": "TOKEN", "login_time": None } def get_fake_delete(self, route, params=None): ...
"<MY-ACCESS-TOKEN>"
assert
string_literal
tests/unit/test_kite_object.py
test_set_access_token_meth
TestKiteConnectObject
64
null
zerodha/pykiteconnect
import utils import time import warnings params = { "exchange": "NSE", "tradingsymbol": "RELIANCE", "transaction_type": "BUY", "quantity": 1 } def is_pending_order(status): """Check if the status is pending order status.""" status = status.upper() if ("COMPLETE" in status or "REJECT" in st...
to_price
assert
variable
tests/integration/test_connect_write.py
test_order_modify_limit_regular
333
null
zerodha/pykiteconnect
import utils import time import warnings params = { "exchange": "NSE", "tradingsymbol": "RELIANCE", "transaction_type": "BUY", "quantity": 1 } def is_pending_order(status): """Check if the status is pending order status.""" status = status.upper() if ("COMPLETE" in status or "REJECT" in st...
0
assert
numeric_literal
tests/integration/test_connect_write.py
test_place_order_slm_regular
196
null
zerodha/pykiteconnect
import utils import time import warnings params = { "exchange": "NSE", "tradingsymbol": "RELIANCE", "transaction_type": "BUY", "quantity": 1 } def is_pending_order(status): """Check if the status is pending order status.""" status = status.upper() if ("COMPLETE" in status or "REJECT" in st...
order_id
assert
variable
tests/integration/test_connect_write.py
test_order_cancel_regular
302
null
zerodha/pykiteconnect
import six import json from mock import Mock from base64 import b64encode from hashlib import sha1 from autobahn.websocket.protocol import WebSocketProtocol class TestTicker: def test_sendclose(self, protocol): protocol.sendClose() assert protocol.transport._written is not None assert p...
protocol.STATE_CLOSING
assert
complex_expr
tests/unit/test_ticker.py
test_sendclose
TestTicker
43
null
zerodha/pykiteconnect
import pytest from mock import patch import responses import requests from kiteconnect import KiteConnect import kiteconnect.exceptions as ex def get_fake_token(self, route, params=None): return { "access_token": "TOKEN", "login_time": None } def get_fake_delete(self, route, params=None): ...
"<ACCESS-TOKEN>"
assert
string_literal
tests/unit/test_kite_object.py
test_set_access_token_meth
TestKiteConnectObject
61
null
zerodha/pykiteconnect
import six import json from mock import Mock from base64 import b64encode from hashlib import sha1 from autobahn.websocket.protocol import WebSocketProtocol class TestTicker: def test_sendMessage(self, protocol): assert protocol.state ==
protocol.STATE_OPEN
assert
complex_expr
tests/unit/test_ticker.py
test_sendMessage
TestTicker
46
null
zerodha/pykiteconnect
import six import json from mock import Mock from base64 import b64encode from hashlib import sha1 from autobahn.websocket.protocol import WebSocketProtocol class TestTicker: def test_sendclose(self, protocol): protocol.sendClose() assert protocol.transport._written is not
None
assert
none_literal
tests/unit/test_ticker.py
test_sendclose
TestTicker
42
null
zerodha/pykiteconnect
import pytest from mock import patch import responses import requests from kiteconnect import KiteConnect import kiteconnect.exceptions as ex def get_fake_token(self, route, params=None): return { "access_token": "TOKEN", "login_time": None } def get_fake_delete(self, route, params=None): ...
"https://kite.zerodha.com/connect/login?api_key=<API-KEY>&v=3"
assert
string_literal
tests/unit/test_kite_object.py
test_login_url
TestKiteConnectObject
25
null
zerodha/pykiteconnect
import pytest from mock import patch import responses import requests from kiteconnect import KiteConnect import kiteconnect.exceptions as ex def get_fake_token(self, route, params=None): return { "access_token": "TOKEN", "login_time": None } def get_fake_delete(self, route, params=None): ...
"token expired it seems! please login again"
assert
string_literal
tests/unit/test_kite_object.py
test_set_session_expiry_hook_meth
TestKiteConnectObject
58
null
zerodha/pykiteconnect
import pytest import responses import kiteconnect.exceptions as ex import utils @responses.activate def test_get_gtt(kiteconnect): """Test single gtt fetch.""" responses.add( responses.GET, "{0}{1}".format(kiteconnect.root, kiteconnect._routes["gtt.info"].format(trigger_id=123)), body=...
123
assert
numeric_literal
tests/unit/test_connect.py
test_get_gtt
289
null
zerodha/pykiteconnect
import pytest from mock import patch import responses import requests from kiteconnect import KiteConnect import kiteconnect.exceptions as ex def get_fake_token(self, route, params=None): return { "access_token": "TOKEN", "login_time": None } def get_fake_delete(self, route, params=None): ...
ex.TokenException)
pytest.raises
complex_expr
tests/unit/test_kite_object.py
test_set_session_expiry_hook_meth
TestKiteConnectObject
56
null
zerodha/pykiteconnect
import pytest import responses import kiteconnect.exceptions as ex import utils @responses.activate def test_order_margins(kiteconnect): """ Test order margins and charges """ responses.add( responses.POST, "{0}{1}".format(kiteconnect.root, kiteconnect._routes["order.margins"]), body=u...
0
assert
numeric_literal
tests/unit/test_connect.py
test_order_margins
380
null
zerodha/pykiteconnect
import pytest from mock import patch import responses import requests from kiteconnect import KiteConnect import kiteconnect.exceptions as ex def get_fake_token(self, route, params=None): return { "access_token": "TOKEN", "login_time": None } def get_fake_delete(self, route, params=None): ...
True
assert
bool_literal
tests/unit/test_kite_object.py
test_request_without_pooling
TestKiteConnectObject
28
null
zerodha/pykiteconnect
import pytest from mock import patch import responses import requests from kiteconnect import KiteConnect import kiteconnect.exceptions as ex def get_fake_token(self, route, params=None): return { "access_token": "TOKEN", "login_time": None } def get_fake_delete(self, route, params=None): ...
2
assert
numeric_literal
tests/unit/test_kite_object.py
test_request_pooling
TestKiteConnectObject
38
null
zerodha/pykiteconnect
import utils import time import warnings params = { "exchange": "NSE", "tradingsymbol": "RELIANCE", "transaction_type": "BUY", "quantity": 1 } def is_pending_order(status): """Check if the status is pending order status.""" status = status.upper() if ("COMPLETE" in status or "REJECT" in st...
tag
assert
variable
tests/integration/test_connect_write.py
test_place_order_tag
218
null
dgilland/pydash
from copy import deepcopy import pytest import pydash as _ parametrize = pytest.mark.parametrize pydash_methods = _.filter_(dir(_), lambda m: callable(getattr(_, m, None))) def test_chaining_late_value_reuse(): square_sum = _.chain().power(2).sum() assert square_sum([1, 2, 3, 4]) == 30 assert square_s...
4
assert
numeric_literal
tests/test_chaining.py
test_chaining_late_value_reuse
85
null
dgilland/pydash
import pytest import pydash as _ parametrize = pytest.mark.parametrize @parametrize( "case,expected", [ ((5, 3), 8), ], ) def test_add(case, expected): assert _.add(*case) ==
expected
assert
variable
tests/test_numerical.py
test_add
16
null
dgilland/pydash
from argparse import Namespace from collections import defaultdict, namedtuple import datetime as dt import pytest import pydash as _ from . import helpers parametrize = pytest.mark.parametrize today = dt.date.today() SomeNamedTuple = namedtuple("SomeNamedTuple", ["a", "b"]) @parametrize( "obj,path,expected,...
new_obj
assert
variable
tests/test_objects.py
test_unset
959
null
dgilland/pydash
from argparse import Namespace from collections import defaultdict, namedtuple import datetime as dt import pytest import pydash as _ from . import helpers parametrize = pytest.mark.parametrize today = dt.date.today() SomeNamedTuple = namedtuple("SomeNamedTuple", ["a", "b"]) def test_get__should_not_populate_def...
{}
assert
collection
tests/test_objects.py
test_get__should_not_populate_defaultdict
403
null
dgilland/pydash
from copy import deepcopy import pytest import pydash as _ parametrize = pytest.mark.parametrize pydash_methods = _.filter_(dir(_), lambda m: callable(getattr(_, m, None))) def test_chaining_commit(): chain = _.chain([1, 2, 3, 4]).power(2).sum() committed = chain.commit() assert chain is not
committed
assert
variable
tests/test_chaining.py
test_chaining_commit
118
null
dgilland/pydash
from copy import deepcopy import pytest import pydash as _ parametrize = pytest.mark.parametrize pydash_methods = _.filter_(dir(_), lambda m: callable(getattr(_, m, None))) def test_chaining_plant(): value = [1, 2, 3, 4] square_sum1 = _.chain(value).power(2).sum() def root_value(wrapper): if i...
test_value
assert
variable
tests/test_chaining.py
test_chaining_plant
108
null
dgilland/pydash
from argparse import Namespace from collections import defaultdict, namedtuple import datetime as dt import pytest import pydash as _ from . import helpers parametrize = pytest.mark.parametrize today = dt.date.today() SomeNamedTuple = namedtuple("SomeNamedTuple", ["a", "b"]) @parametrize( "case", [ ...
case
assert
variable
tests/test_objects.py
test_clone
64
null
dgilland/pydash
from collections import namedtuple import math from operator import attrgetter, itemgetter, methodcaller import pytest import pydash as _ from . import helpers parametrize = pytest.mark.parametrize def test_find_class_object(): obj = helpers.Object(a=1, b=2) assert _.find([None, {}, obj], {"b": 2}) ==
obj
assert
variable
tests/test_collections.py
test_find_class_object
144
null
dgilland/pydash
import math import pytest import pydash as _ parametrize = pytest.mark.parametrize @parametrize( "case,filter_by,expected", [ ([1, 2, 3, 4, 5, 6], lambda x: x % 2 == 0, [2, 4, 6]), ([1, 2, 3, 4], lambda x: x >= 3, [3, 4]), ], ) def test_remove(case, filter_by, expected): original = l...
set([])
assert
func_call
tests/test_arrays.py
test_remove
500
null
dgilland/pydash
from argparse import Namespace from collections import defaultdict, namedtuple import datetime as dt import pytest import pydash as _ from . import helpers parametrize = pytest.mark.parametrize today = dt.date.today() SomeNamedTuple = namedtuple("SomeNamedTuple", ["a", "b"]) @parametrize( "case,expected", ...
expected
assert
variable
tests/test_objects.py
test_assign
30
null
dgilland/pydash
from copy import deepcopy import pytest import pydash as _ parametrize = pytest.mark.parametrize pydash_methods = _.filter_(dir(_), lambda m: callable(getattr(_, m, None))) def test_chaining_commit(): chain = _.chain([1, 2, 3, 4]).power(2).sum() committed = chain.commit() assert chain is not committed...
committed.value()
assert
func_call
tests/test_chaining.py
test_chaining_commit
119
null
dgilland/pydash
import re from urllib.parse import parse_qsl, urlsplit import pytest import pydash as _ parametrize = pytest.mark.parametrize @parametrize( "case,expected", [ ("foo bar baz", "fooBarBaz"), ("foo bar baz", "fooBarBaz"), ("foo__bar_baz", "fooBarBaz"), ("foo-_bar-_-baz", "fooBa...
expected
assert
variable
tests/test_strings.py
test_camel_case
42
null
dgilland/pydash
from copy import deepcopy import pytest import pydash as _ parametrize = pytest.mark.parametrize pydash_methods = _.filter_(dir(_), lambda m: callable(getattr(_, m, None))) def test_chaining_lazy(): tracker = {"called": False} def interceptor(value): tracker["called"] = True return value.p...
3
assert
numeric_literal
tests/test_chaining.py
test_chaining_lazy
74
null
dgilland/pydash
import math import pytest import pydash as _ parametrize = pytest.mark.parametrize @parametrize( "case,expected,after", [ (([1, 2, 3],), 3, [1, 2]), (([1, 2, 3], 0), 1, [2, 3]), (([1, 2, 3], 1), 2, [1, 3]), ], ) def test_pop(case, expected, after): array = case[0] assert ...
after
assert
variable
tests/test_arrays.py
test_pop
423
null
dgilland/pydash
import typing as t import pydash as _ def typed_function(row: int, index: int, col: t.List[t.Any]): return row + 1 def test_annotated_iteratee(): assert _.map_([1, 2], typed_function) ==
[2, 3]
assert
collection
tests/test_annotations.py
test_annotated_iteratee
11
null
dgilland/pydash
import time from unittest import mock import pytest import pydash as _ parametrize = pytest.mark.parametrize def flip(case, args, expected): func = _.flip(case) assert func(args) == expected def test_flow_argcount(): assert _.flow(lambda x, y: x + y, lambda x: x * 2)._argcount ==
2
assert
numeric_literal
tests/test_functions.py
test_flow_argcount
394
null
dgilland/pydash
import time from unittest import mock import pytest import pydash as _ parametrize = pytest.mark.parametrize def test_curry_arity_max_from_func(): def func(data, accum, id): accum[id] = _.reduce_(data, lambda total, n: total + n) return accum ids = [1] data = [1, 2] curried_func_wi...
{1: 3}
assert
collection
tests/test_functions.py
test_curry_arity_max_from_func
108
null
dgilland/pydash
import re from urllib.parse import parse_qsl, urlsplit import pytest import pydash as _ parametrize = pytest.mark.parametrize @parametrize( "case,expected", [ ({"args": [""], "kwargs": {}}, ""), ({"args": ["/"], "kwargs": {}}, "/"), ({"args": ["http://github.com"], "kwargs": {}}, "ht...
e_path
assert
variable
tests/test_strings.py
test_url
1,190
null
dgilland/pydash
import time from unittest import mock import pytest import pydash as _ parametrize = pytest.mark.parametrize @parametrize( "case,expected", [ ((lambda: 3, 2), 3), ((lambda: 3, -1), 3), ], ) def test_after(case, expected): done = _.after(*case) for _x in range(case[1] - 1): ...
None
assert
none_literal
tests/test_functions.py
test_after
24
null
dgilland/pydash
from collections import namedtuple import math from operator import attrgetter, itemgetter, methodcaller import pytest import pydash as _ from . import helpers parametrize = pytest.mark.parametrize @parametrize( "case", [ [1, 2, 3, 4, 5, 6], ], ) def test_sample(case): assert _.sample(case...
case
assert
variable
tests/test_collections.py
test_sample
923
null
dgilland/pydash
from copy import deepcopy import pytest import pydash as _ parametrize = pytest.mark.parametrize pydash_methods = _.filter_(dir(_), lambda m: callable(getattr(_, m, None))) @parametrize( "value,methods", [([1, 2, 3, 4], [("without", (2, 3)), ("reject", (lambda x: x > 1,))])] ) def test_chaining(value, methods)...
expected
assert
variable
tests/test_chaining.py
test_chaining
36
null
dgilland/pydash
from copy import deepcopy import pytest import pydash as _ parametrize = pytest.mark.parametrize pydash_methods = _.filter_(dir(_), lambda m: callable(getattr(_, m, None))) def test_chaining_late_value(): square_sum = _.chain().power(2).sum() assert square_sum([1, 2, 3, 4]) ==
30
assert
numeric_literal
tests/test_chaining.py
test_chaining_late_value
79
null
dgilland/pydash
from copy import deepcopy import pytest import pydash as _ parametrize = pytest.mark.parametrize pydash_methods = _.filter_(dir(_), lambda m: callable(getattr(_, m, None))) def test_chaining_plant(): value = [1, 2, 3, 4] square_sum1 = _.chain(value).power(2).sum() def root_value(wrapper): if i...
value
assert
variable
tests/test_chaining.py
test_chaining_plant
102
null
dgilland/pydash
import time from unittest import mock import pytest import pydash as _ parametrize = pytest.mark.parametrize @parametrize("case,expected", [((lambda a, b: a / b, 4, 2), 2)]) def test_attempt(case, expected): assert _.attempt(*case) ==
expected
assert
variable
tests/test_utilities.py
test_attempt
14
null
dgilland/pydash
from copy import deepcopy import pytest import pydash as _ parametrize = pytest.mark.parametrize pydash_methods = _.filter_(dir(_), lambda m: callable(getattr(_, m, None))) def test_chaining_late_value_override(): square_sum = _.chain([1, 2, 3, 4]).power(2).sum() assert square_sum([5, 6, 7, 8]) ==
174
assert
numeric_literal
tests/test_chaining.py
test_chaining_late_value_override
90
null
dgilland/pydash
import time from unittest import mock import pytest import pydash as _ parametrize = pytest.mark.parametrize def test_now(): present = int(time.time() * 1000) # Add some leeway when comparing time. assert (present - 1) <=
_.now()
assert
func_call
tests/test_utilities.py
test_now
302
null
dgilland/pydash
import time from unittest import mock import pytest import pydash as _ parametrize = pytest.mark.parametrize @parametrize( "case,delay_count", [({"attempts": 3}, 0), ({"attempts": 3}, 1), ({"attempts": 3}, 2), ({"attempts": 5}, 3)], ) def test_retry_success(mock_sleep, case, delay_count): counter = {Tru...
True
assert
bool_literal
tests/test_utilities.py
test_retry_success
499
null
dgilland/pydash
import time from unittest import mock import pytest import pydash as _ parametrize = pytest.mark.parametrize @parametrize("case", ["foo", "bar"]) def test_constant(case): assert _.constant(case)() ==
case
assert
variable
tests/test_utilities.py
test_constant
105
null
dgilland/pydash
import time from unittest import mock import pytest import pydash as _ parametrize = pytest.mark.parametrize @parametrize("case,minimum,maximum", [((), 0, 1), ((25,), 0, 25), ((5, 10), 5, 10)]) def test_random(case, minimum, maximum): for _x in range(50): rnd = _.random(*case) assert isinstance(...
rnd
assert
variable
tests/test_utilities.py
test_random
364
null
dgilland/pydash
from copy import deepcopy import pytest import pydash as _ parametrize = pytest.mark.parametrize pydash_methods = _.filter_(dir(_), lambda m: callable(getattr(_, m, None))) def test_chaining_methods(): chain = _.chain([]) for method in dir(_): if not callable(method): continue ...
getattr(_, method)
assert
func_call
tests/test_chaining.py
test_chaining_methods
22
null
dgilland/pydash
import datetime import decimal import operator import re import pytest import pydash as _ from . import helpers parametrize = pytest.mark.parametrize @parametrize( "value,other,expected", [("a", "a", True), (None, None, True), (None, "", False), (1, str(1), False)], ) def test_eq(value, other, expected): ...
expected
assert
variable
tests/test_predicates.py
test_eq
21
null
dgilland/pydash
from argparse import Namespace from collections import defaultdict, namedtuple import datetime as dt import pytest import pydash as _ from . import helpers parametrize = pytest.mark.parametrize today = dt.date.today() SomeNamedTuple = namedtuple("SomeNamedTuple", ["a", "b"]) @parametrize( "obj,path", [ ...
None
assert
none_literal
tests/test_objects.py
test_get__does_not_raise_for_dict_or_list_when_path_restricted
430
null
aymenfurter/microagents
import unittest from unittest.mock import MagicMock from integrations.memoize import SQLiteMemoization, memoize_to_sqlite import uuid import os class TestSQLiteMemoization(unittest.TestCase): def setUpClass(cls): cls.db_file = 'test.db' cls.memoizer = SQLiteMemoization(cls.db_file) cls.mem...
"Hash computation should return a string")
self.assertIsInstance
string_literal
tests/test_sqlite_memoization.py
test_hash_computation_returns_string
TestSQLiteMemoization
26
null
aymenfurter/microagents
import unittest from unittest.mock import Mock, patch from agents.agent_lifecycle import AgentLifecycle from agents.agent_persistence_manager import AgentPersistenceManager from agents.microagent import MicroAgent from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentLifecycle(unittest.TestCase): ...
"Bootstrap Agent")
self.assertEqual
string_literal
tests/test_agent_lifecycle.py
test_create_prime_agent_adds_agent
TestAgentLifecycle
32
null
aymenfurter/microagents
import unittest import sqlite3 import tempfile import os import json from integrations.sqlite_agent_persistence import SQLiteAgentPersistence class TestSQLiteAgentPersistence(unittest.TestCase): def setUp(self): self.db_file = tempfile.mktemp() self.persistence = SQLiteAgentPersistence(filename=se...
agent_dict)
self.assertEqual
variable
tests/test_sqlite_agent_persistance.py
test_fetch_agent
TestSQLiteAgentPersistence
45
null
aymenfurter/microagents
import numpy as np import unittest from agents.microagent import MicroAgent from agents.agent_serializer import AgentSerializer from unittest.mock import Mock from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentSerializer(unittest.TestCase): def test_full_serialization(self): self.mock_...
20)
self.assertEqual
numeric_literal
tests/test_agent_serializer.py
test_full_serialization
TestAgentSerializer
30
null
aymenfurter/microagents
import unittest from unittest.mock import Mock, patch from agents.agent_lifecycle import AgentLifecycle from agents.agent_persistence_manager import AgentPersistenceManager from agents.microagent import MicroAgent from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentLifecycle(unittest.TestCase): ...
expected_prompt)
self.assertEqual
variable
tests/test_agent_lifecycle.py
test_generate_llm_prompt_returns_prompt
TestAgentLifecycle
44
null
aymenfurter/microagents
import unittest from unittest.mock import MagicMock from integrations.memoize import SQLiteMemoization, memoize_to_sqlite import uuid import os class TestSQLiteMemoization(unittest.TestCase): def setUpClass(cls): cls.db_file = 'test.db' cls.memoizer = SQLiteMemoization(cls.db_file) cls.mem...
"pong")
self.assertEqual
string_literal
tests/test_sqlite_memoization.py
test_memoization_decorator_caches_function_output
TestSQLiteMemoization
42
null
aymenfurter/microagents
import unittest from unittest.mock import Mock, patch from agents.agent_lifecycle import AgentLifecycle from agents.agent_persistence_manager import AgentPersistenceManager from agents.microagent import MicroAgent from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentLifecycle(unittest.TestCase): ...
0)
self.assertEqual
numeric_literal
tests/test_agent_lifecycle.py
test_cleanup_agents_removes_stopped_agents
TestAgentLifecycle
23
null
aymenfurter/microagents
import unittest import sqlite3 import tempfile import os import json from integrations.sqlite_agent_persistence import SQLiteAgentPersistence class TestSQLiteAgentPersistence(unittest.TestCase): def setUp(self): self.db_file = tempfile.mktemp() self.persistence = SQLiteAgentPersistence(filename=se...
self.persistence.fetch_agent('non_existent'))
self.assertIsNone
func_call
tests/test_sqlite_agent_persistance.py
test_non_existent_agent
TestSQLiteAgentPersistence
58
null
aymenfurter/microagents
import numpy as np import unittest from agents.microagent import MicroAgent from agents.agent_serializer import AgentSerializer from unittest.mock import Mock from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentSerializer(unittest.TestCase): def test_deserialization(self): self.mock_age...
2)
self.assertEqual
numeric_literal
tests/test_agent_serializer.py
test_deserialization
TestAgentSerializer
56
null
aymenfurter/microagents
import unittest from agents.agent_response import AgentResponse class TestAgentResponse(unittest.TestCase): def setUp(self): # Setup your OpenAIAPIWrapper, Manager, and other dependencies here # For the test, we can use mock objects or simplified versions self.agent_response = AgentRespons...
IndexError)
self.assertRaises
variable
tests/test_agent_response.py
test_parse_agent_info
TestAgentResponse
32
null
aymenfurter/microagents
import unittest from unittest.mock import Mock, patch from agents.agent_lifecycle import AgentLifecycle from agents.agent_persistence_manager import AgentPersistenceManager from agents.microagent import MicroAgent from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentLifecycle(unittest.TestCase): ...
1)
self.assertEqual
numeric_literal
tests/test_agent_lifecycle.py
test_create_prime_agent_adds_agent
TestAgentLifecycle
31
null
aymenfurter/microagents
import unittest import logging from gradio_ui.log_handler import ListLogHandler class TestListLogHandler(unittest.TestCase): def setUp(self): self.logger = logging.getLogger("test_logger") self.log_handler = ListLogHandler() self.log_handler.setLevel(logging.DEBUG) self.logger.addH...
logs)
self.assertIn
variable
tests/test_loghandler.py
test_log_capture
TestListLogHandler
17
null
aymenfurter/microagents
import unittest from unittest.mock import Mock, patch from agents.agent_serializer import AgentSerializer from agents.agent_persistence_manager import AgentPersistenceManager from integrations.sqlite_agent_persistence import SQLiteAgentPersistence from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgent...
2)
self.assertEqual
numeric_literal
tests/test_agent_persistance_manager.py
test_load_all_agents
TestAgentPersistenceManager
63
null
aymenfurter/microagents
import unittest from unittest.mock import MagicMock from integrations.memoize import SQLiteMemoization, memoize_to_sqlite import uuid import os class TestSQLiteMemoization(unittest.TestCase): def setUpClass(cls): cls.db_file = 'test.db' cls.memoizer = SQLiteMemoization(cls.db_file) cls.mem...
cursor.fetchone())
self.assertIsNotNone
func_call
tests/test_sqlite_memoization.py
test_initialization_creates_cache_table
TestSQLiteMemoization
22
null
aymenfurter/microagents
import unittest from unittest.mock import Mock import numpy as np from agents.agent_lifecycle import AgentLifecycle from agents.agent_similarity import AgentSimilarity from agents.microagent import MicroAgent from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentSimilarity(unittest.TestCase): d...
1.0)
self.assertAlmostEqual
numeric_literal
tests/test_agent_similarity.py
test_find_closest_agent
TestAgentSimilarity
33
null
aymenfurter/microagents
import unittest import sqlite3 import tempfile import os import json from integrations.sqlite_agent_persistence import SQLiteAgentPersistence class TestSQLiteAgentPersistence(unittest.TestCase): def setUp(self): self.db_file = tempfile.mktemp() self.persistence = SQLiteAgentPersistence(filename=se...
cursor.fetchone())
self.assertIsNotNone
func_call
tests/test_sqlite_agent_persistance.py
test_initialize_database
TestSQLiteAgentPersistence
27
null
aymenfurter/microagents
import unittest from unittest.mock import MagicMock from integrations.memoize import SQLiteMemoization, memoize_to_sqlite import uuid import os class TestSQLiteMemoization(unittest.TestCase): def setUpClass(cls): cls.db_file = 'test.db' cls.memoizer = SQLiteMemoization(cls.db_file) cls.mem...
"Caching mechanism should store and retrieve data correctly")
self.assertEqual
string_literal
tests/test_sqlite_memoization.py
test_caching_mechanism_stores_and_retrieves_data_correctly
TestSQLiteMemoization
32
null
aymenfurter/microagents
import unittest import sqlite3 import tempfile import os import json from integrations.sqlite_agent_persistence import SQLiteAgentPersistence class TestSQLiteAgentPersistence(unittest.TestCase): def setUp(self): self.db_file = tempfile.mktemp() self.persistence = SQLiteAgentPersistence(filename=se...
data)
self.assertIsNotNone
variable
tests/test_sqlite_agent_persistance.py
test_save_agent
TestSQLiteAgentPersistence
37
null
aymenfurter/microagents
import numpy as np import unittest from agents.microagent import MicroAgent from agents.agent_serializer import AgentSerializer from unittest.mock import Mock from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentSerializer(unittest.TestCase): def test_full_serialization(self): self.mock_...
[1, 2, 3])
self.assertEqual
collection
tests/test_agent_serializer.py
test_full_serialization
TestAgentSerializer
25
null
aymenfurter/microagents
import unittest from unittest.mock import MagicMock from integrations.memoize import SQLiteMemoization, memoize_to_sqlite import uuid import os class TestSQLiteMemoization(unittest.TestCase): def setUpClass(cls): cls.db_file = 'test.db' cls.memoizer = SQLiteMemoization(cls.db_file) cls.mem...
memoizer.connection)
self.assertIsNone
complex_expr
tests/test_sqlite_memoization.py
test_resource_management_closes_connection
TestSQLiteMemoization
52
null
aymenfurter/microagents
import numpy as np import unittest from agents.microagent import MicroAgent from agents.agent_serializer import AgentSerializer from unittest.mock import Mock from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentSerializer(unittest.TestCase): def test_full_serialization(self): self.mock_...
3)
self.assertEqual
numeric_literal
tests/test_agent_serializer.py
test_full_serialization
TestAgentSerializer
29
null
aymenfurter/microagents
import numpy as np import unittest from agents.microagent import MicroAgent from agents.agent_serializer import AgentSerializer from unittest.mock import Mock from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentSerializer(unittest.TestCase): def test_full_serialization(self): self.mock_...
10)
self.assertEqual
numeric_literal
tests/test_agent_serializer.py
test_full_serialization
TestAgentSerializer
26
null
aymenfurter/microagents
import unittest import logging from gradio_ui.log_handler import ListLogHandler class TestListLogHandler(unittest.TestCase): def setUp(self): self.logger = logging.getLogger("test_logger") self.log_handler = ListLogHandler() self.log_handler.setLevel(logging.DEBUG) self.logger.addH...
0)
self.assertEqual
numeric_literal
tests/test_loghandler.py
test_log_clear
TestListLogHandler
23
null
aymenfurter/microagents
import numpy as np import unittest from agents.microagent import MicroAgent from agents.agent_serializer import AgentSerializer from unittest.mock import Mock from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentSerializer(unittest.TestCase): def test_deserialization(self): self.mock_age...
5)
self.assertEqual
numeric_literal
tests/test_agent_serializer.py
test_deserialization
TestAgentSerializer
57
null
aymenfurter/microagents
import unittest from unittest.mock import Mock, patch from agents.microagent_manager import MicroAgentManager from integrations.openaiwrapper import OpenAIAPIWrapper import openai class TestMicroAgentManager(unittest.TestCase): def setUp(self): self.openai_wrapper = OpenAIAPIWrapper(openai.OpenAI(api_key=...
MicroAgentManager)
self.assertIsInstance
variable
tests/test_microagent_manager.py
test_init
TestMicroAgentManager
20
null
aymenfurter/microagents
import unittest from unittest.mock import Mock, patch from agents.agent_serializer import AgentSerializer from agents.agent_persistence_manager import AgentPersistenceManager from integrations.sqlite_agent_persistence import SQLiteAgentPersistence from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgent...
mock_agent_dict)
assert_*
variable
tests/test_agent_persistance_manager.py
test_save_agent_working_not_prime
TestAgentPersistenceManager
28
null
aymenfurter/microagents
import unittest from agents.agent_response import AgentResponse class TestAgentResponse(unittest.TestCase): def setUp(self): # Setup your OpenAIAPIWrapper, Manager, and other dependencies here # For the test, we can use mock objects or simplified versions self.agent_response = AgentRespons...
'ReadTitle')
self.assertEqual
string_literal
tests/test_agent_response.py
test_parse_agent_info
TestAgentResponse
15
null
aymenfurter/microagents
import numpy as np import unittest from agents.microagent import MicroAgent from agents.agent_serializer import AgentSerializer from unittest.mock import Mock from integrations.openaiwrapper import OpenAIAPIWrapper class TestAgentSerializer(unittest.TestCase): def test_full_serialization(self): self.mock_...
"purpose")
self.assertEqual
string_literal
tests/test_agent_serializer.py
test_full_serialization
TestAgentSerializer
24
null
uriyyo/fastapi-pagination
from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars def test_len_or_none(): assert len_or_none(None) is
None
assert
none_literal
tests/ext/test_utils.py
test_len_or_none
5
null
uriyyo/fastapi-pagination
from typing import ClassVar, Generic, TypeVar import pytest from fastapi import FastAPI, Query, status from fastapi_pagination import Page, Params, add_pagination, paginate from fastapi_pagination.bases import AbstractPage, AbstractParams from fastapi_pagination.cursor import CursorPage, encode_cursor from fastapi_pa...
Page
assert
variable
tests/test_customization.py
test_customization_no_args
71
null
uriyyo/fastapi-pagination
from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars def test_wrap_scalars(): assert wrap_scalars([]) == [] assert wrap_scalars([[]]) == [[]] assert wrap_scalars([1, 2]) == [[1], [2]] assert wrap_scalars([1, [2, 3]]) ==
[[1], [2, 3]]
assert
collection
tests/ext/test_utils.py
test_wrap_scalars
22
null
uriyyo/fastapi-pagination
from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars def test_unwrap_scalars(): assert unwrap_scalars([]) == [] assert unwrap_scalars([[]]) ==
[[]]
assert
collection
tests/ext/test_utils.py
test_unwrap_scalars
12
null
uriyyo/fastapi-pagination
from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars def test_wrap_scalars(): assert wrap_scalars([]) == [] assert wrap_scalars([[]]) == [[]] assert wrap_scalars([1, 2]) ==
[[1], [2]]
assert
collection
tests/ext/test_utils.py
test_wrap_scalars
21
null
uriyyo/fastapi-pagination
from typing import ClassVar, Generic, TypeVar import pytest from fastapi import FastAPI, Query, status from fastapi_pagination import Page, Params, add_pagination, paginate from fastapi_pagination.bases import AbstractPage, AbstractParams from fastapi_pagination.cursor import CursorPage, encode_cursor from fastapi_pa...
15
assert
numeric_literal
tests/test_customization.py
test_aliases
TestUseParamsFieldsAlias
214
null
uriyyo/fastapi-pagination
from collections.abc import AsyncIterator, Sequence from contextlib import asynccontextmanager from typing import Annotated, Any, Generic, TypeVar import pytest from fastapi import Depends, FastAPI, Request, Response, status from fastapi.routing import APIRouter from fastapi.testclient import TestClient from pydantic ...
2
assert
numeric_literal
tests/test_api.py
test_add_pagination_additional_dependencies
156
null
uriyyo/fastapi-pagination
from typing import Generic, TypeVar import pytest from fastapi import Query from fastapi_pagination import Page, Params from fastapi_pagination.bases import AbstractPage, AbstractParams, BaseRawParams, RawParams from fastapi_pagination.cursor import CursorParams T = TypeVar("T") C = TypeVar("C") def test_params_cas...
p
assert
variable
tests/test_bases.py
test_params_cast
49
null
uriyyo/fastapi-pagination
from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars def test_len_or_none(): assert len_or_none(None) is None assert len_or_none([]) ==
0
assert
numeric_literal
tests/ext/test_utils.py
test_len_or_none
6
null