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
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
[]
assert
collection
tests/er_diagram/test_er_diagram_inline_anno.py
test_resolver_factory_with_er_configs_inherit
143
null
allmonday/pydantic-resolve
from pydantic_resolve.utils import conversion from typing import Optional from pydantic import ConfigDict, BaseModel, ValidationError import pytest def test_pydantic(): class A(BaseModel): name: Optional[str] = None a = A(name=None) value = conversion.try_parse_data_to_target_field_type(a, 'na...
'123'
assert
string_literal
tests/utils/test_parse.py
test_pydantic
12
null
allmonday/pydantic-resolve
import pytest from pydantic_resolve import config_global_resolver, query from pydantic_resolve.graphql import GraphQLHandler from pydantic import BaseModel from typing import List, Optional, Dict, Any class TestGraphQLIntegration: def setup_method(self): """设置测试环境""" # 创建简单的 ERD(只用于测试) fr...
result["data"]
assert
complex_expr
tests/graphql/test_e2e.py
test_simple_query_execution
TestGraphQLIntegration
52
null
allmonday/pydantic-resolve
from __future__ import annotations import pytest from typing import List from collections import Counter, defaultdict from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import cre...
expected_2
assert
variable
tests/resolver/test_11_sqlalchemy_query_global_filter.py
test_sqlite_and_dataloader
203
null
allmonday/pydantic-resolve
import pytest from pydantic_resolve import config_global_resolver, query from pydantic_resolve.graphql import GraphQLHandler from pydantic import BaseModel from typing import List, Optional, Dict, Any class TestGraphQLIntegration: def setup_method(self): """设置测试环境""" # 创建简单的 ERD(只用于测试) fr...
0
assert
numeric_literal
tests/graphql/test_e2e.py
test_invalid_query
TestGraphQLIntegration
76
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import Optional, List from pydantic import BaseModel from pydantic_resolve.analysis import Analytic, convert_metadata_key_as_kls from pydantic_resolve import LoaderDepend async def loader_fn(keys): return keys def test_get_all_fields(): result = Analytic().scan(S...
v.items()
assert
func_call
tests/core/test_field_pydantic.py
test_get_all_fields
79
null
allmonday/pydantic-resolve
import pytest from demo.graphql.entities_v2 import ( diagram_v2, UserEntityV2, PostEntityV2, init_db_v2, ) from pydantic_resolve.graphql import GraphQLHandler from pydantic_resolve import config_global_resolver def handler(): """创建 GraphQLHandler 实例""" # 重新初始化数据库,确保测试状态干净 init_db_v2() #...
0
assert
numeric_literal
demo/graphql/test_entities_v2.py
test_handler_has_query_map
TestQueryRecognition
38
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import List import pytest from collections import Counter from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import create_async_eng...
1
assert
numeric_literal
tests/resolver/test_17_mapper_deep.py
test_sqlite_and_dataloader
149
null
allmonday/pydantic-resolve
from __future__ import annotations from typing import Optional, List from pydantic import BaseModel from pydantic_resolve.analysis import Analytic, convert_metadata_key_as_kls from pydantic_resolve import LoaderDepend async def loader_fn(keys): return keys def test_resolve_params(): result = Analytic().scan(S...
result[key].items()
assert
func_call
tests/core/test_field_pydantic.py
test_resolve_params
163
null
allmonday/pydantic-resolve
import pytest from typing import List from pydantic import BaseModel from pydantic_resolve.resolver import Resolver @pytest.mark.asyncio async def test_case_0(): class Kar(BaseModel): name: str desc: str = '' def resolve_desc(self, ancestor_context): return f"{self.name} - {anc...
ValueError)
pytest.raises
variable
tests/resolver/test_32_dynamic_variable_for_descdant_loader_exception.py
test_case_0
38
null
allmonday/pydantic-resolve
import asyncio from pydantic import ConfigDict, BaseModel import pytest import pydantic_resolve.utils.class_util import pydantic_resolve.utils.conversion import pydantic_resolve.utils.dataloader def test_get_class_field_annotations(): class B: hello: str = 'hello' class C: hello: str ...
[('hello', False)]
assert
collection
tests/utils/test_utils.py
test_get_class_field_annotations
26
null
allmonday/pydantic-resolve
from pydantic_resolve.utils import conversion from typing import Optional from pydantic import ConfigDict, BaseModel, ValidationError import pytest def test_orm(): class B(BaseModel): age: int model_config = ConfigDict(from_attributes=True) class A(BaseModel): b: Optional[B] clas...
B(age=21)
assert
func_call
tests/utils/test_parse.py
test_orm
39
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
[]
assert
collection
tests/er_diagram/test_er_diagram_inline_short.py
test_resolver_factory_with_er_configs_inherit
140
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import ( config_resolver, Entity, Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ErDiagram, ensure_subset, Loader ) from aiodataloader import DataLoad...
[]
assert
collection
tests/er_diagram/test_er_diagram.py
test_resolver_factory_with_er_configs_inherit
172
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.openapi import model_config from pydantic import BaseModel, Field from pydantic_resolve import Resolver from pydantic.json_schema import GenerateJsonSchema as GenerateJsonSchema import pytest from typing import Annotated @pytest.mark.asyncio async def test_schema_config_inheritance_issue():...
{'name', 'id', 'age', 'email'}
assert
collection
tests/utils/test_model_config.py
test_schema_config_inheritance_issue
103
null
allmonday/pydantic-resolve
from pydantic import BaseModel from pydantic_resolve.utils.er_diagram import base_entity, Relationship Base = base_entity() def test_bases(): assert MyModel in Base.entities assert AnotherModel in Base.entities assert MyModelSub not in Base.entities assert len(Base.entities) ==
2
assert
numeric_literal
tests/er_diagram/test_er_diagram_base.py
test_bases
29
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve.analysis import Analytic from pydantic_resolve.exceptions import ResolverTargetAttrNotFound, MissingCollector from typing import Optional, List def test_inheritance_chain(): """Inheritance chain should correctly resolve resolve methods""" resul...
inherited['object_fields']
assert
complex_expr
tests/analysis/test_analysis_edge_cases.py
test_inheritance_chain
131
null
allmonday/pydantic-resolve
import pytest from demo.graphql.entities_v2 import ( diagram_v2, UserEntityV2, PostEntityV2, init_db_v2, ) from pydantic_resolve.graphql import GraphQLHandler from pydantic_resolve import config_global_resolver def handler(): """创建 GraphQLHandler 实例""" # 重新初始化数据库,确保测试状态干净 init_db_v2() #...
1
assert
numeric_literal
demo/graphql/test_entities_v2.py
test_query_user_by_id
TestQueryExecution
101
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve import base_entity, Relationship def test_no_conflict_works(): """测试无冲突的情况正常工作""" BaseEntity = base_entity() class PostEntity(BaseModel, BaseEntity): id: int # 应该不抛出异常 class UserEntity(BaseModel, BaseEntity): post_...
None
assert
none_literal
tests/graphql/test_field_name_conflicts.py
test_no_conflict_works
128
null
allmonday/pydantic-resolve
from typing import List import pytest from collections import Counter, defaultdict from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.or...
expected
assert
variable
tests/resolver/test_7_sqlalchemy_query.py
test_sqlite_and_dataloader
157
null
allmonday/pydantic-resolve
import pytest from typing import Optional, List from pydantic import BaseModel from pydantic_resolve import ( ErDiagram, Entity, Relationship, QueryConfig, MutationConfig, query, mutation, ) from pydantic_resolve.graphql import SchemaBuilder async def get_all_users(limit: int = 10) -> List...
'创建文章'
assert
string_literal
tests/graphql/test_query_mutation_config.py
test_mutation_config_basic
TestQueryMutationConfig
103
null
allmonday/pydantic-resolve
from pydantic_resolve.graphql import SchemaBuilder from tests.graphql.fixtures.entities import BaseEntity class TestSchemaBuilder: def setup_method(self): """设置测试环境""" self.er_diagram = BaseEntity.get_diagram() self.builder = SchemaBuilder(self.er_diagram) def test_extract_query_metho...
0
assert
numeric_literal
tests/graphql/test_schema_builder.py
test_extract_query_methods
TestSchemaBuilder
46
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve import base_entity, Relationship def test_schema_builder_validation(): """测试 SchemaBuilder 的运行时验证""" from pydantic_resolve.graphql.schema_builder import SchemaBuilder # 创建一个新的 Base,避免与其他测试冲突 TestBase = base_entity() # RelatedEntit...
schema
assert
variable
tests/graphql/test_field_name_conflicts.py
test_schema_builder_validation
160
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import config_resolver from pydantic_resolve import Relationship, MultipleRelationship, Link, LoadBy, DefineSubset, ensure_subset, base_entity from aiodataloader import DataLoader BASE_ENTITY = base_entity()...
["foo1", "foo2"]
assert
collection
tests/er_diagram/test_er_diagram_inline_short.py
test_resolver_factory_with_er_configs_inherit
136
null
allmonday/pydantic-resolve
from pydantic_resolve import query def test_query_decorator_sets_attributes(): """测试 @query 装饰器正确设置函数属性""" @query(name='test_query', description='测试查询') async def my_query(cls, limit: int = 10): return [] # 验证返回的是 classmethod assert isinstance(my_query, classmethod) # 验证属性被正确设置(在 __f...
'测试查询'
assert
string_literal
tests/graphql/test_query_decorator.py
test_query_decorator_sets_attributes
22
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from typing import Optional from pydantic_resolve import Resolver import asyncio @pytest.mark.asyncio async def test_resolve_object(): s = Z(a=A(b=B(name="kikodo")), resolve_age=21) result = await Resolver().resolve(s) expected = { "a": { "b...
expected
assert
variable
tests/resolver/test_21_not_stop_by_idle_level.py
test_resolve_object
52
null
allmonday/pydantic-resolve
import pytest from demo.graphql.entities_v2 import ( diagram_v2, UserEntityV2, PostEntityV2, init_db_v2, ) from pydantic_resolve.graphql import GraphQLHandler from pydantic_resolve import config_global_resolver def handler(): """创建 GraphQLHandler 实例""" # 重新初始化数据库,确保测试状态干净 init_db_v2() #...
2
assert
numeric_literal
demo/graphql/test_entities_v2.py
test_post_entity_has_relationships
TestErDiagramConfiguration
348
null
allmonday/pydantic-resolve
from __future__ import annotations import pytest from typing import List from collections import Counter, defaultdict from aiodataloader import DataLoader from pydantic import ConfigDict, BaseModel from sqlalchemy import select from sqlalchemy.ext.asyncio import async_sessionmaker from sqlalchemy.ext.asyncio import cre...
expected_1
assert
variable
tests/resolver/test_11_sqlalchemy_query_global_filter.py
test_sqlite_and_dataloader
202
null
allmonday/pydantic-resolve
from __future__ import annotations import pytest from typing import Optional, List from pydantic import BaseModel from aiodataloader import DataLoader from pydantic_resolve.analysis import Analytic from pydantic_resolve import LoaderDepend, LoaderFieldNotProvidedError from pydantic_resolve.loader_manager import validat...
instance._query_meta
assert
complex_expr
tests/core/test_field_validate_and_create_loader_instance.py
test_instance_6
147
null
allmonday/pydantic-resolve
from pydantic import BaseModel, Field from pydantic_resolve import serialization from typing import List, Optional, Annotated def test_list_nesting(): """Test that serialization decorator works with List[Model] nesting""" schema = Order.model_json_schema(mode='serialization') # Root class: items and total...
item_def['required']
assert
complex_expr
tests/utils/test_serialization.py
test_list_nesting
91
null
allmonday/pydantic-resolve
import pytest from pydantic_resolve import config_global_resolver, query from pydantic_resolve.graphql import GraphQLHandler from pydantic import BaseModel from typing import List, Optional, Dict, Any class TestGraphQLIntegration: def setup_method(self): """设置测试环境""" # 创建简单的 ERD(只用于测试) fr...
None
assert
none_literal
tests/graphql/test_e2e.py
test_invalid_query
TestGraphQLIntegration
75
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve.utils.er_diagram import ErDiagram, Entity def test_duplicate_entity_names_raises_error(): """Test that duplicate entity names from different modules raise an error.""" class UserEntityA(BaseModel): id: int name: str class...
ValueError)
pytest.raises
variable
tests/er_diagram/test_duplicate_entity_names.py
test_duplicate_entity_names_raises_error
26
null
allmonday/pydantic-resolve
from pydantic_resolve.utils.types import ( _is_list, get_core_types, shelling_type, get_class_field_annotations, _is_optional ) from typing import Optional, Union, List, Dict, Tuple, Set import pytest def test_complex_nested_types(): """Test complex nested type scenarios""" # Triple nested...
(int, str)
assert
collection
tests/utils/test_types.py
test_complex_nested_types
172
null
allmonday/pydantic-resolve
from pydantic import BaseModel from typing import List from pydantic_resolve import Resolver, LoaderDepend from aiodataloader import DataLoader import pytest from pydantic_resolve.exceptions import GlobalLoaderFieldOverlappedError async def loader_fn_a(keys): return [ k**2 for k in keys ] @pytest.mark.asyncio asy...
4
assert
numeric_literal
tests/resolver/test_33_global_loader_filter.py
test_case_0
49
null
allmonday/pydantic-resolve
import pytest from pydantic import BaseModel from pydantic_resolve.utils.er_diagram import base_entity, Relationship def test_valid_list_generic_with_string_ref(): """Test that list['ClassName'] syntax works correctly.""" Base = base_entity() class MyEntity(BaseModel, Base): __relationships__ = [...
list[User]
assert
complex_expr
tests/utils/test_resolve_ref_errors.py
test_valid_list_generic_with_string_ref
209
null
allmonday/pydantic-resolve
import pytest from typing import Optional, Annotated, List from pydantic import BaseModel from pydantic_resolve import ( config_resolver, Entity, Relationship, LoadBy, ErDiagram ) from aiodataloader import DataLoader @pytest.mark.asyncio async def test_load_many_fn_returns_non_iterable(): """T...
(TypeError, AttributeError))
pytest.raises
collection
tests/er_diagram/test_field_fn_exceptions.py
test_load_many_fn_returns_non_iterable
292
null
bottlepy/bottle
import unittest import bottle from bottle import tob, touni from .tools import ServerTestBase, tobs, warn USING_UJSON = True class TestOutputFilter(ServerTestBase): def test_cookie(self): """ WSGI: Cookies """ @bottle.route('/cookie') def test(): bottle.response.set_cookie('b'...
'c=c; Path=/' in c)
self.assertTrue
string_literal
test/test_outputfilter.py
test_cookie
TestOutputFilter
197
null
bottlepy/bottle
import bottle from .tools import ServerTestBase, api from bottle import response class TestAppMounting(ServerTestBase): def setUp(self): ServerTestBase.setUp(self) self.subapp = bottle.Bottle() @self.subapp.route('/') @self.subapp.route('/test/<test>') def test(test='foo'):...
'/test/')
self.assertEqual
string_literal
test/test_mount.py
test_mount_meta
TestAppMounting
42
null
bottlepy/bottle
import unittest import base64 import sys, os.path, tempfile from io import BytesIO import bottle class BaseMultipartTest(unittest.TestCase): def setUp(self): self.reset() def reset(self): self.data = BytesIO() self.parts = None def write(self, *lines): for line in lines: ...
None)
self.assertEqual
none_literal
test/test_multipart.py
assertForm
BaseMultipartTest
43
null
bottlepy/bottle
from __future__ import with_statement import bottle from .tools import ServerTestBase, chdir from bottle import tob, touni, HTTPResponse class TestWsgi(ServerTestBase): def get204(self): """ 204 responses must not return some entity headers """ bad = ('content-length', 'content-type') for ...
'öäü')
self.assertEqual
string_literal
test/test_wsgi.py
test
TestWsgi
110
null
bottlepy/bottle
import os.path import sys import unittest from bottle import ResourceManager class TestResourceManager(unittest.TestCase): def test_path_unique(self): rm = ResourceManager() [rm.add_path(test) for test in TEST_PATHS] self.assertEqual(rm.path,
EXPECTED)
self.assertEqual
variable
test/test_resources.py
test_path_unique
TestResourceManager
56
null
bottlepy/bottle
import unittest import sys, os.path import bottle from bottle import FileUpload, BytesIO, tob import tempfile class TestFileUpload(unittest.TestCase): def assertFilename(self, bad, good): fu = FileUpload(None, None, bad) self.assertEqual(fu.filename, good) def test_save_dir(self): fu ...
open(filepath, 'rb').read())
self.assertEqual
func_call
test/test_fileupload.py
test_save_dir
TestFileUpload
66
null
bottlepy/bottle
import unittest from bottle import Bottle class TestApplicationObject(unittest.TestCase): def test_setattr(self): """ Attributed can be assigned, but only once. """ app = Bottle() app.test = 5 self.assertEqual(5, app.test) self.assertRaises(
AttributeError)
self.assertRaises
variable
test/test_app.py
test_setattr
TestApplicationObject
17
null
bottlepy/bottle
import sys import unittest from bottle import static_file, request, response, parse_date, parse_range_header, Bottle, tob import bottle import wsgiref.util import os import tempfile import time basename = os.path.basename(__file__) root = os.path.dirname(__file__) basename2 = os.path.basename(bottle.__file__) root2 =...
int(parse_date(rs)))
self.assertEqual
func_call
test/test_sendfile.py
test_rfc1123
TestDateParser
26
null
bottlepy/bottle
import unittest import base64 import sys, os.path, tempfile from io import BytesIO import bottle class TestBrokenMultipart(BaseMultipartTest): def assertMPError(self, **ka): self.assertRaises(bottle.MultipartError, self.parse, **ka) def test_no_newline_after_middle_content(self): self.write(...
1)
self.assertEqual
numeric_literal
test/test_multipart.py
test_no_newline_after_middle_content
TestBrokenMultipart
211
null
bottlepy/bottle
from __future__ import with_statement import os import bottle import sys import unittest import wsgiref import wsgiref.util import wsgiref.validate import warnings import mimetypes import uuid from bottle import tob, BytesIO def warn(msg): sys.stderr.write('WARNING: %s\n' % msg.strip()) def tobs(data): '''...
self.urlopen(route, **kargs)['header'].get(name))
self.assertEqual
func_call
test/tools.py
assertHeader
ServerTestBase
142
null
bottlepy/bottle
import os import tempfile import unittest from bottle import ConfigDict class TestConfDict(unittest.TestCase): def test_load_module(self): c = ConfigDict() c.load_module('test.example_settings', True) self.assertEqual(c['A.B.C'],
3)
self.assertEqual
numeric_literal
test/test_config.py
test_load_module
TestConfDict
90
null
bottlepy/bottle
import os import tempfile import unittest from bottle import ConfigDict class TestConfDict(unittest.TestCase): def test_isadict(self): """ ConfigDict should behaves like a normal dict. """ # It is a dict-subclass, so this kind of pointless, but it doen't hurt. d, m = dict(), ConfigDict() ...
m.keys())
self.assertEqual
func_call
test/test_config.py
test_isadict
TestConfDict
15
null
bottlepy/bottle
import sys import unittest from bottle import static_file, request, response, parse_date, parse_range_header, Bottle, tob import bottle import wsgiref.util import os import tempfile import time basename = os.path.basename(__file__) root = os.path.dirname(__file__) basename2 = os.path.basename(bottle.__file__) root2 =...
tob('').join(f.body))
self.assertEqual
func_call
test/test_sendfile.py
test_range
TestSendFile
153
null
bottlepy/bottle
from __future__ import with_statement import unittest from .tools import warn, chdir from bottle import MakoTemplate, mako_template, mako_view, touni class TestMakoTemplate(unittest.TestCase): def test_notfound(self): """ Templates: Unavailable templates""" self.assertRaises(
Exception)
self.assertRaises
variable
test/test_mako.py
test_notfound
TestMakoTemplate
26
null
bottlepy/bottle
import unittest import sys, os import bottle class TestImportHooks(unittest.TestCase): def make_module(self, name, **args): mod = sys.modules.setdefault(name, bottle.new_module(name)) mod.__file__ = '<virtual %s>' % name mod.__dict__.update(**args) return mod def test_import_f...
ImportError)
self.assertRaises
variable
test/test_importhook.py
test_import_fail
TestImportHooks
33
null
bottlepy/bottle
import unittest from bottle import MultiDict, HeaderDict class TestMultiDict(unittest.TestCase): def test_isheader(self): """ HeaderDict replaces by default and title()s its keys """ m = HeaderDict(abc_def=5) m['abc_def'] = 6 self.assertEqual(['6'],
m.getall('abc_def'))
self.assertEqual
func_call
test/test_mdict.py
test_isheader
TestMultiDict
36
null
bottlepy/bottle
import unittest import sys import itertools import bottle from bottle import request, tob, touni, json_dumps, HTTPError, parse_date, CookieError from . import tools import wsgiref.util import base64 from bottle import BaseRequest, BaseResponse, LocalRequest class TestResponse(unittest.TestCase): def test_set_s...
999)
self.assertEqual
numeric_literal
test/test_environ.py
test_set_status
TestResponse
522
null
bottlepy/bottle
import os import tempfile import unittest from bottle import ConfigDict class TestConfDict(unittest.TestCase): def test_meta(self): c = ConfigDict() c.meta_set('bool', 'filter', bool) c.meta_set('int', 'filter', int) c['bool'] = 'I am so true!' c['int'] = '6' self.a...
6)
self.assertEqual
numeric_literal
test/test_config.py
test_meta
TestConfDict
65
null
bottlepy/bottle
from __future__ import with_statement import unittest from bottle import SimpleTemplate, TemplateError, view, template, touni, tob, html_quote import re, os import traceback from .tools import chdir class TestSimpleTemplate(unittest.TestCase): def assertRenders(self, tpl, to, *args, **vars): if isinstance(...
result)
self.assertEqual
variable
test/test_stpl.py
test_template_shortcut
TestSimpleTemplate
207
null
bottlepy/bottle
import os.path import sys import unittest from bottle import ResourceManager class TestResourceManager(unittest.TestCase): def test_get(self): rm = ResourceManager() rm.add_path('/first/') rm.add_path(__file__) rm.add_path('/last/') self.assertEqual(None, rm.lookup('notexis...
rm.lookup(os.path.basename(__file__)))
self.assertEqual
func_call
test/test_resources.py
test_get
TestResourceManager
91
null
bottlepy/bottle
import unittest import base64 import sys, os.path, tempfile from io import BytesIO import bottle class BaseMultipartTest(unittest.TestCase): def setUp(self): self.reset() def reset(self): self.data = BytesIO() self.parts = None def write(self, *lines): for line in lines: ...
"utf8")
self.assertEqual
string_literal
test/test_multipart.py
assertForm
BaseMultipartTest
45
null
bottlepy/bottle
import unittest from bottle import MultiDict, HeaderDict class TestMultiDict(unittest.TestCase): def test_isadict(self): """ MultiDict should behaves like a normal dict """ d, m = dict(a=5), MultiDict(a=5) d['key'], m['key'] = 'value', 'value' d['k2'], m['k2'] = 'v1', 'v1' d...
'key' in m)
self.assertEqual
string_literal
test/test_mdict.py
test_isadict
TestMultiDict
20
null
bottlepy/bottle
import unittest from bottle import MultiDict, HeaderDict class TestMultiDict(unittest.TestCase): def test_ismulti(self): """ MultiDict has some special features """ m = MultiDict(a=5) m['a'] = 6 self.assertEqual([5, 6], m.getall('a')) self.assertEqual([],
m.getall('b'))
self.assertEqual
func_call
test/test_mdict.py
test_ismulti
TestMultiDict
29
null
bottlepy/bottle
from __future__ import with_statement import bottle from .tools import ServerTestBase, chdir from bottle import tob, touni, HTTPResponse class TestDecorators(ServerTestBase): def test_autoroute(self): app = bottle.Bottle() def a(): pass def b(x): pass def c(x, y): pass def ...
list(bottle.yieldroutes(a)))
self.assertEqual
func_call
test/test_wsgi.py
test_autoroute
TestDecorators
513
null
bottlepy/bottle
from __future__ import with_statement import unittest from bottle import SimpleTemplate, TemplateError, view, template, touni, tob, html_quote import re, os import traceback from .tools import chdir class TestSimpleTemplate(unittest.TestCase): def assertRenders(self, tpl, to, *args, **vars): if isinstance(...
tpl.render(*args, **vars))
self.assertEqual
func_call
test/test_stpl.py
assertRenders
TestSimpleTemplate
14
null
bottlepy/bottle
import unittest import bottle from bottle import tob, touni from .tools import ServerTestBase, tobs, warn USING_UJSON = True class TestOutputFilter(ServerTestBase): def test_cookie(self): """ WSGI: Cookies """ @bottle.route('/cookie') def test(): bottle.response.set_cookie('b'...
'b=b' in c)
self.assertTrue
string_literal
test/test_outputfilter.py
test_cookie
TestOutputFilter
196
null
bottlepy/bottle
import unittest from . import tools from bottle import HTTPResponse, HTTPError, json_dumps def my_decorator(func): def wrapper(*a, **ka): return list(func(*a, **ka))[-1] class TestPluginManagement(tools.ServerTestBase): def verify_installed(self, plugin, otype, **config): self.assertEqual(ty...
plugin in self.app.plugins)
self.assertTrue
complex_expr
test/test_plugins.py
verify_installed
TestPluginManagement
37
null
bottlepy/bottle
import unittest import base64 import sys, os.path, tempfile from io import BytesIO import bottle class TestMultipartParser(BaseMultipartTest): def assertIterline(self, data, *expected, **options): self.assertEqual( list(bottle._MultipartParser(BytesIO(bottle.tob(data)), 'foo', **options)._lin...
"file1")
self.assertEqual
string_literal
test/test_multipart.py
test_multiline_header
TestMultipartParser
168
null
bottlepy/bottle
import unittest import sys, os.path import bottle from bottle import FileUpload, BytesIO, tob import tempfile class TestFileUpload(unittest.TestCase): def test_raw_filename(self): self.assertEqual(FileUpload(None, None, 'x/x').raw_filename,
'x/x')
self.assertEqual
string_literal
test/test_fileupload.py
test_raw_filename
TestFileUpload
15
null
bottlepy/bottle
from __future__ import with_statement import os import bottle import sys import unittest import wsgiref import wsgiref.util import wsgiref.validate import warnings import mimetypes import uuid from bottle import tob, BytesIO def warn(msg): sys.stderr.write('WARNING: %s\n' % msg.strip()) def tobs(data): '''...
deprecated
assert
variable
test/tools.py
api
63
null
bottlepy/bottle
import unittest import sys, os.path import bottle from bottle import FileUpload, BytesIO, tob import tempfile class TestFileUpload(unittest.TestCase): def assertFilename(self, bad, good): fu = FileUpload(None, None, bad) self.assertEqual(fu.filename, good) def test_save_overwrite_lock(self): ...
IOError)
self.assertRaises
variable
test/test_fileupload.py
test_save_overwrite_lock
TestFileUpload
59
null
bottlepy/bottle
import unittest from . import tools from bottle import HTTPResponse, HTTPError, json_dumps def my_decorator(func): def wrapper(*a, **ka): return list(func(*a, **ka))[-1] class TestPluginManagement(tools.ServerTestBase): def verify_installed(self, plugin, otype, **config): self.assertEqual(ty...
self.app)
self.assertEqual
complex_expr
test/test_plugins.py
verify_installed
TestPluginManagement
36
null
bottlepy/bottle
import functools import unittest import bottle from .tools import api from bottle import _re_flatten class TestRoute(unittest.TestCase): @api('0.12') def test_callback_inspection(self): def x(a, b): pass def d(f): @functools.wraps(f) def w(): return f() ...
x)
self.assertEqual
variable
test/test_route.py
test_callback_inspection
TestRoute
29
null
bottlepy/bottle
import unittest from bottle import MultiDict, HeaderDict class TestMultiDict(unittest.TestCase): def test_headergetbug(self): ''' Assure HeaderDict.get() to be case insensitive ''' d = HeaderDict() d['UPPER'] = 'UPPER' d['lower'] = 'lower' self.assertEqual(d.get('upper'), '...
'lower')
self.assertEqual
string_literal
test/test_mdict.py
test_headergetbug
TestMultiDict
47
null
bottlepy/bottle
import unittest from . import tools from bottle import HTTPResponse, HTTPError, json_dumps def my_decorator(func): def wrapper(*a, **ka): return list(func(*a, **ka))[-1] class TestPluginManagement(tools.ServerTestBase): def verify_installed(self, plugin, otype, **config): self.assertEqual(ty...
config)
self.assertEqual
variable
test/test_plugins.py
verify_installed
TestPluginManagement
35
null
bottlepy/bottle
import sys import unittest from bottle import static_file, request, response, parse_date, parse_range_header, Bottle, tob import bottle import wsgiref.util import os import tempfile import time basename = os.path.basename(__file__) root = os.path.dirname(__file__) basename2 = os.path.basename(bottle.__file__) root2 =...
r('bytes=-10'))
self.assertEqual
func_call
test/test_sendfile.py
test_range_parser
TestSendFile
160
null
bottlepy/bottle
import unittest import bottle import threading def run_thread(func): t = threading.Thread(target=func) t.start() t.join() class TestThreadLocals(unittest.TestCase): def run(): bottle.request.bind(e2) self.assertEqual(bottle.request.path,
'/t2')
self.assertEqual
string_literal
test/test_contextlocals.py
run
TestThreadLocals
23
null
bottlepy/bottle
import unittest from . import tools from bottle import HTTPResponse, HTTPError, json_dumps def my_decorator(func): def wrapper(*a, **ka): return list(func(*a, **ka))[-1] class TestPluginAPI(tools.ServerTestBase): def setUp(self): super(TestPluginAPI, self).setUp() @self.app.route('/'...
getattr(plugin, 'closed', False))
self.assertTrue
func_call
test/test_plugins.py
test_close
TestPluginAPI
219
null
bottlepy/bottle
import os.path import sys import unittest from bottle import ResourceManager class TestResourceManager(unittest.TestCase): def test_path_absolutize(self): if sys.platform == 'win32': tests = ('.\\foo\\bar\\', '.\\foo\\bar\\baz', '.\\foo\\baz\\..\\bar\\blub') abspath = os.path.abspa...
[abspath])
self.assertEqual
collection
test/test_resources.py
test_path_absolutize
TestResourceManager
46
null
bottlepy/bottle
import bottle from .tools import ServerTestBase class TestAppException(ServerTestBase): def test_memory_error(self): @bottle.route('/') def test(): raise MemoryError with self.assertRaises(
MemoryError)
self.assertRaises
variable
test/test_exc.py
test_memory_error
TestAppException
17
null
bottlepy/bottle
from __future__ import with_statement import os import bottle import sys import unittest import wsgiref import wsgiref.util import wsgiref.validate import warnings import mimetypes import uuid from bottle import tob, BytesIO def warn(msg): sys.stderr.write('WARNING: %s\n' % msg.strip()) def tobs(data): '''...
self.urlopen(route, **kargs)['body'])
self.assertEqual
func_call
test/tools.py
assertBody
ServerTestBase
134
null
bottlepy/bottle
import os.path import sys import unittest from bottle import ResourceManager class TestResourceManager(unittest.TestCase): def test_path_order(self): rm = ResourceManager() rm.add_path('/middle/') rm.add_path('/first/', index=0) rm.add_path('/last/') if sys.platform == 'wi...
['C:\\first\\', 'C:\\middle\\', 'C:\\last\\'])
self.assertEqual
collection
test/test_resources.py
test_path_order
TestResourceManager
81
null
bottlepy/bottle
from __future__ import with_statement import bottle from .tools import ServerTestBase, chdir from bottle import tob, touni, HTTPResponse class TestAppShortcuts(ServerTestBase): def setUp(self): ServerTestBase.setUp(self) def testWithStatement(self): default = bottle.default_app() inner...
other.__doc__)
self.assertEqual
complex_expr
test/test_wsgi.py
assertWraps
TestAppShortcuts
534
null
bottlepy/bottle
import unittest from . import tools from bottle import HTTPResponse, HTTPError, json_dumps def my_decorator(func): def wrapper(*a, **ka): return list(func(*a, **ka))[-1] class TestPluginManagement(tools.ServerTestBase): def verify_installed(self, plugin, otype, **config): self.assertEqual(t...
otype)
self.assertEqual
variable
test/test_plugins.py
verify_installed
TestPluginManagement
34
null
bottlepy/bottle
import unittest import bottle import threading def run_thread(func): t = threading.Thread(target=func) t.start() t.join() class TestThreadLocals(unittest.TestCase): def test_request(self): e1 = {'PATH_INFO': '/t1'} e2 = {'PATH_INFO': '/t2'} def run(): bottle.reques...
'/t1')
self.assertEqual
string_literal
test/test_contextlocals.py
test_request
TestThreadLocals
26
null
bottlepy/bottle
import functools import unittest import bottle from .tools import api from bottle import _re_flatten class TestReFlatten(unittest.TestCase): def test_re_flatten(self): self.assertEqual(_re_flatten(r"(?:aaa)(_bbb)"),
'(?:aaa)(?:_bbb)')
self.assertEqual
string_literal
test/test_route.py
test_re_flatten
TestReFlatten
11
null
bottlepy/bottle
import unittest import sys __author__ = 'atc' from bottle import Bottle, request, tob, BaseRequest class TestRoutes(unittest.TestCase): def test_route1(self): body = "abc" request.environ['CONTENT_LENGTH'] = str(len(tob(body))) request.environ['wsgi.input'] = BytesIO() request.env...
dict(msg="bob", len=3))
self.assertEqual
func_call
test/test_oorouting.py
test_route1
TestRoutes
39
null
bottlepy/bottle
from __future__ import with_statement import unittest from bottle import SimpleTemplate, TemplateError, view, template, touni, tob, html_quote import re, os import traceback from .tools import chdir class TestSimpleTemplate(unittest.TestCase): def assertRenders(self, tpl, to, *args, **vars): if isinstance(...
t.render())
self.assertEqual
func_call
test/test_stpl.py
test_global_config
TestSimpleTemplate
229
null
bottlepy/bottle
import unittest import bottle import threading def run_thread(func): t = threading.Thread(target=func) t.start() t.join() class TestThreadLocals(unittest.TestCase): def run(): bottle.response.bind() bottle.response.content_type='test/thread' self.assertEqual(b...
'test/thread')
self.assertEqual
string_literal
test/test_contextlocals.py
run
TestThreadLocals
35
null
bottlepy/bottle
import os.path import sys import unittest from bottle import ResourceManager class TestResourceManager(unittest.TestCase): def test_path_create(self): import shutil import tempfile tempdir = tempfile.mkdtemp() try: rm = ResourceManager() exists = rm.add_path...
False)
self.assertEqual
bool_literal
test/test_resources.py
test_path_create
TestResourceManager
29
null
bottlepy/bottle
import unittest import bottle import warnings class TestRouter(unittest.TestCase): CGI = False def setUp(self): self.r = bottle.Router() def add(self, path, target, method='GET', **ka): with warnings.catch_warnings() as r: warnings.simplefilter("ignore") self.r.add...
url)
self.assertEqual
variable
test/test_router.py
testBuild
TestRouter
105
null
bottlepy/bottle
from __future__ import with_statement import bottle from .tools import ServerTestBase, chdir from bottle import tob, touni, HTTPResponse class TestRouteDecorator(ServerTestBase): def test_after_request_sees_HTTPError_response(self): """ Issue #671 """ called = [] @bottle.hook('after_requ...
called)
self.assertEqual
variable
test/test_wsgi.py
test_after_request_sees_HTTPError_response
TestRouteDecorator
351
null
bottlepy/bottle
import unittest from bottle import Jinja2Template, jinja2_template, jinja2_view, touni from .tools import warn, chdir class TestJinja2Template(unittest.TestCase): def test_string(self): """ Templates: Jinja2 string""" t = Jinja2Template('start {{var}} end').render(var='var') self.assertEq...
''.join(t))
self.assertEqual
string_literal
test/test_jinja2.py
test_string
TestJinja2Template
13
null
bottlepy/bottle
from __future__ import with_statement import bottle from .tools import ServerTestBase, chdir from bottle import tob, touni, HTTPResponse class TestRouteDecorator(ServerTestBase): def test_callback(self): def test(x=5): return str(x) rv = bottle.route(callback=test) self.assertBody('5', '/t...
test)
self.assertEqual
variable
test/test_wsgi.py
test_callback
TestRouteDecorator
451
null
bottlepy/bottle
import unittest from . import tools from bottle import HTTPResponse, HTTPError, json_dumps def my_decorator(func): def wrapper(*a, **ka): return list(func(*a, **ka))[-1] class TestPluginManagement(tools.ServerTestBase): def verify_installed(self, plugin, otype, **config): self.assertEqual(ty...
self.app.plugins)
self.assertFalse
complex_expr
test/test_plugins.py
test_uninstall_all
TestPluginManagement
79
null
bottlepy/bottle
from __future__ import with_statement import unittest from bottle import SimpleTemplate, TemplateError, view, template, touni, tob, html_quote import re, os import traceback from .tools import chdir class TestSimpleTemplate(unittest.TestCase): def assertRenders(self, tpl, to, *args, **vars): if isinstance(...
html_quote('<\'\r\n\t"\\>'))
self.assertEqual
func_call
test/test_stpl.py
test_htmlutils_quote
TestSimpleTemplate
61
null
bottlepy/bottle
from __future__ import with_statement import bottle from .tools import ServerTestBase, chdir from bottle import tob, touni, HTTPResponse class TestWsgi(ServerTestBase): def get204(self): """ 204 responses must not return some entity headers """ bad = ('content-length', 'content-type') for ...
'c=c; Path=/' in c)
self.assertTrue
string_literal
test/test_wsgi.py
test_cookie
TestWsgi
171
null
bottlepy/bottle
import unittest import bottle from bottle import tob, touni from .tools import ServerTestBase, tobs, warn USING_UJSON = True class TestOutputFilter(ServerTestBase): def test_fatal_error(self): @self.app.route('/') def test(): raise KeyboardInterrupt() self.assertRaises(
KeyboardInterrupt)
self.assertRaises
variable
test/test_outputfilter.py
test_fatal_error
TestOutputFilter
53
null
bottlepy/bottle
from __future__ import with_statement import unittest from bottle import SimpleTemplate, TemplateError, view, template, touni, tob, html_quote import re, os import traceback from .tools import chdir class TestSimpleTemplate(unittest.TestCase): def assertRenders(self, tpl, to, *args, **vars): if isinstance(...
IndexError)
self.assertRaises
variable
test/test_stpl.py
test_error
TestSimpleTemplate
187
null
bottlepy/bottle
import unittest import sys, os import bottle class TestImportHooks(unittest.TestCase): def make_module(self, name, **args): mod = sys.modules.setdefault(name, bottle.new_module(name)) mod.__file__ = '<virtual %s>' % name mod.__dict__.update(**args) return mod def test_direkt_i...
mod)
self.assertEqual
variable
test/test_importhook.py
test_direkt_import
TestImportHooks
17
null
bottlepy/bottle
import bottle from .tools import ServerTestBase class TestAppException(ServerTestBase): def test_system_Exit(self): @bottle.route('/') def test(): raise SystemExit with self.assertRaises(
SystemExit)
self.assertRaises
variable
test/test_exc.py
test_system_Exit
TestAppException
23
null
bottlepy/bottle
from __future__ import with_statement import bottle from .tools import ServerTestBase, chdir from bottle import tob, touni, HTTPResponse class TestDecorators(ServerTestBase): def test_autoroute(self): app = bottle.Bottle() def a(): pass def b(x): pass def c(x, y): pass def ...
list(bottle.yieldroutes(b)))
self.assertEqual
func_call
test/test_wsgi.py
test_autoroute
TestDecorators
514
null
bottlepy/bottle
import unittest from bottle import Jinja2Template, jinja2_template, jinja2_view, touni from .tools import warn, chdir class TestJinja2Template(unittest.TestCase): def test_custom_tests(self): """Templates: jinja2 custom tests """ from bottle import jinja2_template as template TEMPL = touni...
t.render(var=1))
self.assertEqual
func_call
test/test_jinja2.py
test_custom_tests
TestJinja2Template
55
null
bottlepy/bottle
import unittest from . import tools from bottle import HTTPResponse, HTTPError, json_dumps def my_decorator(func): def wrapper(*a, **ka): return list(func(*a, **ka))[-1] class TestPluginManagement(tools.ServerTestBase): def verify_installed(self, plugin, otype, **config): self.assertEqual(ty...
plugin2 in self.app.plugins)
self.assertTrue
complex_expr
test/test_plugins.py
test_uninstall_by_instance
TestPluginManagement
58
null