repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/agents/tests/test_semantic_mcp.py | test_simple_query | assert | none_literal | 97 | import json
import ibis
import pandas as pd
import pytest
from fastmcp import Client
from fastmcp.exceptions import ToolError
from boring_semantic_layer import MCPSemanticModel, to_semantic_table
def con():
"""DuckDB connection for all tests."""
return ibis.duckdb.connect(":memory:")
def sample_models(con):... | None | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/agents/tests/test_tools.py | test_init_basic | assert | none_literal | 30 | import json
from pathlib import Path
from unittest.mock import Mock, patch
import pytest
from returns.result import Failure, Success
def mock_models():
"""Mock semantic models."""
mock_model = Mock()
mock_model.dimensions = {"carrier", "origin", "destination"}
mock_model.measures = {"flight_count", "a... | None | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/chart/tests/test_backends.py | test_bar_chart_categorical | assert | none_literal | 54 | import ibis
import pandas as pd
import pytest
from boring_semantic_layer import to_semantic_table
def con():
"""DuckDB connection for all tests."""
return ibis.duckdb.connect(":memory:")
def flights_model(con):
"""Create a sample flights semantic table for testing."""
flights_df = pd.DataFrame(
... | None | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/chart/tests/test_chart.py | test_basic_bar_chart | assert | none_literal | 55 | import ibis
import pandas as pd
import pytest
from boring_semantic_layer import to_semantic_table
def con():
"""DuckDB connection for all tests."""
return ibis.duckdb.connect(":memory:")
def flights_model(con):
"""Create a sample flights semantic table for testing."""
flights_df = pd.DataFrame(
... | None | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/chart/tests/test_utils.py | test_detect_time_dimension_from_dtype_no_datetime | assert | none_literal | 25 | import pandas as pd
import pytest
from boring_semantic_layer.chart.utils import (
clean_field_name,
convert_datetime_to_strings,
detect_chart_type_generic,
detect_time_dimension_from_dtype,
get_non_time_dimensions,
has_time_dimension,
melt_dataframe_for_multiple_measures,
pivot_datafram... | None | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_chart.py | test_basic_bar_chart | assert | none_literal | 55 | import ibis
import pandas as pd
import pytest
from boring_semantic_layer import to_semantic_table
def con():
"""DuckDB connection for all tests."""
return ibis.duckdb.connect(":memory:")
def flights_model(con):
"""Create a sample flights semantic table for testing."""
flights_df = pd.DataFrame(
... | None | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_date_filter_fix.py | test_none_passthrough | assert | none_literal | 14 | import ibis
import pytest
from boring_semantic_layer.api import to_semantic_table
from boring_semantic_layer.query import Filter, query
class TestFilterValueConversion:
def test_none_passthrough(self):
"""Test that None passes through unchanged."""
f = Filter(filter={"field": "x", "operator": "="... | None | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_dependency_groups.py | test_mcp_available_if_installed | assert | none_literal | 22 | import sys
from pathlib import Path
import pytest
class TestIntegrationWithRealDependencies:
def test_mcp_available_if_installed(self):
"""Verify MCPSemanticModel works when fastmcp is installed."""
try:
import fastmcp # noqa: F401
mcp_available = True
except Imp... | None | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_description.py | test_to_semantic_table_without_description | assert | none_literal | 18 | import ibis
from boring_semantic_layer import to_semantic_table
def test_to_semantic_table_without_description():
"""Test that to_semantic_table works without description (backward compatibility)."""
con = ibis.duckdb.connect(":memory:")
data = ibis.memtable({"a": [1, 2, 3], "b": ["x", "y", "z"]})
tbl... | None | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_lazy_imports.py | test_mcp_import_without_langchain_installed | assert | none_literal | 19 | class TestLazyImportsIssue145:
def test_mcp_import_without_langchain_installed(self):
"""Issue #145: MCPSemanticModel should import even when langchain is missing.
This is the exact reproduction case from the issue:
1. pip install boring-semantic-layer fastmcp (without langchain)
2... | None | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/agents/tests/test_semantic_mcp.py | test_get_model_with_time_dimension | assert | bool_literal | 95 | import json
import ibis
import pandas as pd
import pytest
from fastmcp import Client
from fastmcp.exceptions import ToolError
from boring_semantic_layer import MCPSemanticModel, to_semantic_table
def con():
"""DuckDB connection for all tests."""
return ibis.duckdb.connect(":memory:")
def sample_models(con):... | True | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/agents/tests/test_tools.py | test_query_model_all_params_combined | assert | bool_literal | 52 | import json
from pathlib import Path
from unittest.mock import Mock, patch
import pytest
from returns.result import Failure, Success
def mock_models():
"""Mock semantic models."""
mock_model = Mock()
mock_model.dimensions = {"carrier", "origin", "destination"}
mock_model.measures = {"flight_count", "a... | True | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/chart/tests/test_utils.py | test_has_time_dimension_true | assert | bool_literal | 23 | import pandas as pd
import pytest
from boring_semantic_layer.chart.utils import (
clean_field_name,
convert_datetime_to_strings,
detect_chart_type_generic,
detect_time_dimension_from_dtype,
get_non_time_dimensions,
has_time_dimension,
melt_dataframe_for_multiple_measures,
pivot_datafram... | True | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_dimension_helpers.py | test_entity_dimension_basic | assert | bool_literal | 21 | import ibis
from boring_semantic_layer import entity_dimension, time_dimension, to_semantic_table
def test_entity_dimension_basic():
"""Test that entity_dimension creates a dimension with is_entity=True."""
con = ibis.duckdb.connect(":memory:")
data = ibis.memtable({"business_id": [1, 2, 3], "value": [100... | True | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_graph_utils.py | test_find_entity_dimensions_with_entities | assert | bool_literal | 38 | import ibis
import pytest
from ibis.expr.operations.relations import Aggregate
from boring_semantic_layer.expr import SemanticModel
from boring_semantic_layer.graph_utils import (
bfs,
find_dimensions_and_measures,
find_entity_dimensions,
find_event_timestamp_dimensions,
gen_children_of,
replac... | True | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_semantic_mcp.py | test_get_model_with_time_dimension | assert | bool_literal | 95 | import json
import ibis
import pandas as pd
import pytest
from fastmcp import Client
from fastmcp.exceptions import ToolError
from boring_semantic_layer import MCPSemanticModel, to_semantic_table
def con():
"""DuckDB connection for all tests."""
return ibis.duckdb.connect(":memory:")
def sample_models(con):... | True | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_utils.py | test_safe_comparisons | assert | bool_literal | 17 | from __future__ import annotations
from ibis import _
from returns.result import Failure, Success
from boring_semantic_layer.utils import (
_is_url,
expr_to_ibis_string,
ibis_string_to_expr,
safe_eval,
)
def test_safe_comparisons():
result = safe_eval("5 > 3 and 2 < 10")
assert isinstance(res... | True | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_xorq_convert.py | test_serialize_dimensions_with_metadata | assert | bool_literal | 48 | from __future__ import annotations
import pytest
from returns.result import Failure, Success
from boring_semantic_layer.utils import expr_to_ibis_string, ibis_string_to_expr
from boring_semantic_layer.xorq_convert import (
from_tagged,
serialize_dimensions,
serialize_measures,
to_tagged,
try_impor... | True | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_xorq_integration.py | test_metadata_preservation | assert | bool_literal | 55 | from __future__ import annotations
import pytest
from boring_semantic_layer import SemanticModel
from boring_semantic_layer.xorq_convert import from_tagged, to_tagged, try_import_xorq
class TestXorqIntegration:
def test_metadata_preservation(self):
"""Test that BSL metadata is preserved through xorq tag... | True | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_dependency_graph.py | test_predecessors_successors_nonexistent | assert | func_call | 21 | import ibis
from boring_semantic_layer.api import to_semantic_table
from boring_semantic_layer.graph_utils import (
graph_bfs,
graph_invert,
graph_predecessors,
graph_successors,
graph_to_dict,
)
def test_predecessors_successors_nonexistent():
"""Test predecessors/successors for non-existent n... | set() | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_graph_utils.py | test_replace_nodes_identity_replacer_leaves_expr_unchanged | assert | func_call | 23 | import ibis
import pytest
from ibis.expr.operations.relations import Aggregate
from boring_semantic_layer.expr import SemanticModel
from boring_semantic_layer.graph_utils import (
bfs,
find_dimensions_and_measures,
find_entity_dimensions,
find_event_timestamp_dimensions,
gen_children_of,
replac... | str(expr) | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_config_projection_pushdown.py | test_projection_pushdown_filters_unused_columns | assert | func_call | 89 | import contextlib
import ibis
import pytest
from boring_semantic_layer import to_semantic_table, to_untagged
pytestmark = pytest.mark.xfail(
reason="Projection pushdown disabled for xorq vendored ibis compatibility"
)
def wide_table(ibis_con):
"""Create a wide table with many unused columns."""
# Create... | sql.lower() | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_measure_reference_styles.py | test_measure_ref_via_attribute | pytest.approx | func_call | 24 | import ibis
import pandas as pd
import pytest
from boring_semantic_layer import to_semantic_table
def test_measure_ref_via_attribute():
"""Test referencing measures via attribute access (current behavior)."""
con = ibis.duckdb.connect(":memory:")
flights = pd.DataFrame({"carrier": ["AA", "AA", "UA"]})
... | df.pct.sum()) | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
boringdata/boring-semantic-layer | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | train | train | src/boring_semantic_layer/tests/test_xorq_integration.py | test_xorq_noop_tag_preservation | assert | func_call | 25 | from __future__ import annotations
import pytest
from boring_semantic_layer import SemanticModel
from boring_semantic_layer.xorq_convert import from_tagged, to_tagged, try_import_xorq
class TestXorqFeatures:
def test_xorq_noop_tag_preservation(self):
"""Test that xorq noop tags preserve query structure.... | len(df_tagged) | 1f50c3b8a2e2293fe9fde570bed71d0fa5e84b5d | 48 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_app.py | test_setattr | self.assertRaises | variable | 12 | 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.assertEquals(5, app.test)
self.assertRaises( | AttributeError) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_meta | self.assertEqual | numeric_literal | 15 | import sys
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.assertTrue(c['b... | 6) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_load_dict | self.assertEqual | numeric_literal | 12 | import sys
import unittest
from bottle import ConfigDict
class TestConfDict(unittest.TestCase):
def test_load_dict(self):
c = ConfigDict()
d = dict(a=dict(b=dict(foo=5, bar=6), baz=7))
c.load_dict(d)
self.assertEqual(c['a.b.foo'], | 5) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_load_dict | self.assertEqual | numeric_literal | 14 | import sys
import unittest
from bottle import ConfigDict
class TestConfDict(unittest.TestCase):
def test_load_dict(self):
c = ConfigDict()
d = dict(a=dict(b=dict(foo=5, bar=6), baz=7))
c.load_dict(d)
self.assertEqual(c['a.b.foo'], 5)
self.assertEqual(c['a.b.bar'], 6)
... | 7) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_load_module | self.assertEqual | numeric_literal | 11 | import sys
import unittest
from bottle import ConfigDict
class TestConfDict(unittest.TestCase):
def test_load_module(self):
c = ConfigDict()
c.load_module('example_settings', True)
self.assertEqual(c['A.B.C'], | 3) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_isadict | self.assertEqual | func_call | 21 | import sys
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()
d['key']... | len(m)) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_load_dict | self.assertEqual | complex_expr | 22 | import sys
import unittest
from bottle import ConfigDict
class TestConfDict(unittest.TestCase):
def test_load_dict(self):
c = ConfigDict()
d = dict(a=dict(b=dict(foo=5, bar=6), baz=7))
c.load_dict(d)
self.assertEqual(c['a.b.foo'], 5)
self.assertEqual(c['a.b.bar'], 6)
... | c[key]) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_write | self.assertEqual | string_literal | 11 | import sys
import unittest
from bottle import ConfigDict
class TestConfDict(unittest.TestCase):
def test_write(self):
c = ConfigDict()
c['key'] = 'value'
self.assertEqual(c['key'], | 'value') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_isadict | self.assertEqual | func_call | 15 | import sys
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()
d['key']... | m.keys()) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_isadict | self.assertRaises | variable | 24 | import sys
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()
d['key']... | KeyError) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_write | self.assertEqual | string_literal | 14 | import sys
import unittest
from bottle import ConfigDict
class TestConfDict(unittest.TestCase):
def test_write(self):
c = ConfigDict()
c['key'] = 'value'
self.assertEqual(c['key'], 'value')
self.assertTrue('key' in c)
c['key'] = 'value2'
self.assertEqual(c['key'], | 'value2') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_update | self.assertEqual | string_literal | 13 | import sys
import unittest
from bottle import ConfigDict
class TestConfDict(unittest.TestCase):
def test_update(self):
c = ConfigDict()
c['key'] = 'value'
c.update(key='value2', key2='value3')
self.assertEqual(c['key'], 'value2')
self.assertEqual(c['key2'], | 'value3') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_fallback | self.assertEqual | string_literal | 25 | import sys
import unittest
from bottle import ConfigDict
class TestConfDict(unittest.TestCase):
def test_fallback(self):
fallback = ConfigDict()
fallback['key'] = 'fallback'
primary = ConfigDict()
primary._set_fallback(fallback)
# Check copy of existing values from fallbac... | 'primary') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_isadict | self.assertEqual | string_literal | 22 | import sys
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()
d['key']... | 'key' in m) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_isadict | self.assertEqual | string_literal | 23 | import sys
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()
d['key']... | 'cay' in m) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_config.py | test_write | self.assertTrue | string_literal | 12 | import sys
import unittest
from bottle import ConfigDict
class TestConfDict(unittest.TestCase):
def test_write(self):
c = ConfigDict()
c['key'] = 'value'
self.assertEqual(c['key'], 'value')
self.assertTrue( | 'key' in c) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_contextlocals.py | test_request | self.assertEqual | string_literal | 21 | 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') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_contextlocals.py | run | self.assertEqual | string_literal | 15 | 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') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_contextlocals.py | test_response | self.assertEqual | string_literal | 22 | 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_response(self):
def run():
bottle.response.bind()
bottle.response.content_type='test/thread'
... | 'test/main') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_contextlocals.py | run | self.assertEqual | string_literal | 16 | 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') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_environ.py | test_app_property | self.assertEqual | numeric_literal | 19 | import unittest
import sys
import bottle
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError, parse_date
from test import tools
import wsgiref.util
import base64
from bottle import BaseRequest, BaseResponse, LocalRequest
class TestRequest(unittest.TestCase):
def test_app_property(self):
... | 5) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_environ.py | test_dict_access | self.assertEqual | variable | 23 | import unittest
import sys
import bottle
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError, parse_date
from test import tools
import wsgiref.util
import base64
from bottle import BaseRequest, BaseResponse, LocalRequest
class TestRequest(unittest.TestCase):
def test_dict_access(self):
... | v) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_environ.py | test_multipart | self.assertEqual | variable | 48 | import unittest
import sys
import bottle
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError, parse_date
from test import tools
import wsgiref.util
import base64
from bottle import BaseRequest, BaseResponse, LocalRequest
class TestRequest(unittest.TestCase):
def _test_chunked(self, body, exp... | x) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_environ.py | test_remote_route | self.assertEqual | collection | 28 | import unittest
import sys
import bottle
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError, parse_date
from test import tools
import wsgiref.util
import base64
from bottle import BaseRequest, BaseResponse, LocalRequest
class TestRequest(unittest.TestCase):
def _test_chunked(self, body, exp... | []) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_environ.py | test_remote_route | self.assertEqual | variable | 30 | import unittest
import sys
import bottle
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError, parse_date
from test import tools
import wsgiref.util
import base64
from bottle import BaseRequest, BaseResponse, LocalRequest
class TestRequest(unittest.TestCase):
def _test_chunked(self, body, exp... | ips) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_environ.py | test_set_status | self.assertEqual | numeric_literal | 19 | import unittest
import sys
import bottle
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError, parse_date
from test import tools
import wsgiref.util
import base64
from bottle import BaseRequest, BaseResponse, LocalRequest
class TestResponse(unittest.TestCase):
def test_set_status(self):
... | 200) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_environ.py | test_set_status | self.assertEqual | numeric_literal | 24 | import unittest
import sys
import bottle
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError, parse_date
from test import tools
import wsgiref.util
import base64
from bottle import BaseRequest, BaseResponse, LocalRequest
class TestResponse(unittest.TestCase):
def test_set_status(self):
... | 999) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_environ.py | test_set_status | self.assertEqual | numeric_literal | 29 | import unittest
import sys
import bottle
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError, parse_date
from test import tools
import wsgiref.util
import base64
from bottle import BaseRequest, BaseResponse, LocalRequest
class TestResponse(unittest.TestCase):
def test_set_status(self):
... | 404) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_environ.py | test_json_empty | self.assertEqual | none_literal | 27 | import unittest
import sys
import bottle
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError, parse_date
from test import tools
import wsgiref.util
import base64
from bottle import BaseRequest, BaseResponse, LocalRequest
class TestRequest(unittest.TestCase):
def _test_chunked(self, body, exp... | None) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_environ.py | test_json_valid | self.assertEqual | variable | 33 | import unittest
import sys
import bottle
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError, parse_date
from test import tools
import wsgiref.util
import base64
from bottle import BaseRequest, BaseResponse, LocalRequest
class TestRequest(unittest.TestCase):
def _test_chunked(self, body, exp... | test) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_fileupload.py | assertFilename | self.assertEqual | variable | 12 | import unittest
import sys, os.path
import bottle
from bottle import FileUpload, BytesIO
import tempfile
class TestFileUpload(unittest.TestCase):
def assertFilename(self, bad, good):
fu = FileUpload(None, None, bad)
self.assertEqual(fu.filename, | good) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_fileupload.py | test_name | self.assertEqual | string_literal | 10 | import unittest
import sys, os.path
import bottle
from bottle import FileUpload, BytesIO
import tempfile
class TestFileUpload(unittest.TestCase):
def test_name(self):
self.assertEqual(FileUpload(None, 'abc', None).name, | 'abc') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_fileupload.py | test_raw_filename | self.assertEqual | string_literal | 11 | import unittest
import sys, os.path
import bottle
from bottle import FileUpload, BytesIO
import tempfile
class TestFileUpload(unittest.TestCase):
def test_raw_filename(self):
self.assertEqual(FileUpload(None, None, 'x/x').raw_filename, | 'x/x') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_fileupload.py | test_save_overwrite_lock | self.assertRaises | variable | 16 | import unittest
import sys, os.path
import bottle
from bottle import FileUpload, BytesIO
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) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_fileupload.py | test_save_buffer | self.assertEqual | func_call | 19 | import unittest
import sys, os.path
import bottle
from bottle import FileUpload, BytesIO
import tempfile
class TestFileUpload(unittest.TestCase):
def assertFilename(self, bad, good):
fu = FileUpload(None, None, bad)
self.assertEqual(fu.filename, good)
def test_save_buffer(self):
fu = ... | buff.read()) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_fileupload.py | test_save_dir | self.assertEqual | func_call | 19 | import unittest
import sys, os.path
import bottle
from bottle import FileUpload, BytesIO
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 = Fil... | open(filepath, 'rb').read()) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_formsdict.py | test_attr_access | self.assertEqual | complex_expr | 9 | import unittest
from bottle import FormsDict, touni, tob
class TestFormsDict(unittest.TestCase):
def test_attr_access(self):
""" FomsDict.attribute returs string values as unicode. """
d = FormsDict(py2=tob('瓶'), py3=tob('瓶').decode('latin1'))
self.assertEqual(touni('瓶'), d. | d.py2) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_formsdict.py | test_attr_access | self.assertEqual | complex_expr | 10 | import unittest
from bottle import FormsDict, touni, tob
class TestFormsDict(unittest.TestCase):
def test_attr_access(self):
""" FomsDict.attribute returs string values as unicode. """
d = FormsDict(py2=tob('瓶'), py3=tob('瓶').decode('latin1'))
self.assertEqual(touni('瓶'), d.py2)
se... | d.py3) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_formsdict.py | test_attr_unicode_error | self.assertEqual | complex_expr | 10 | import unittest
from bottle import FormsDict, touni, tob
class TestFormsDict(unittest.TestCase):
def test_attr_unicode_error(self):
""" FomsDict.attribute returs u'' on UnicodeError. """
d = FormsDict(latin=touni('öäüß').encode('latin1'))
self.assertEqual(touni(''), | d.latin) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_formsdict.py | test_attr_missing | self.assertEqual | complex_expr | 10 | import unittest
from bottle import FormsDict, touni, tob
class TestFormsDict(unittest.TestCase):
def test_attr_missing(self):
""" FomsDict.attribute returs u'' on missing keys. """
d = FormsDict()
self.assertEqual(touni(''), | d.missing) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_formsdict.py | test_decode_method | self.assertFalse | complex_expr | 10 | import unittest
from bottle import FormsDict, touni, tob
class TestFormsDict(unittest.TestCase):
def test_decode_method(self):
d = FormsDict(py2=tob('瓶'), py3=tob('瓶').decode('latin1'))
d = d.decode()
self.assertFalse( | d.recode_unicode) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_formsdict.py | test_decode_method | self.assertTrue | func_call | 11 | import unittest
from bottle import FormsDict, touni, tob
class TestFormsDict(unittest.TestCase):
def test_decode_method(self):
d = FormsDict(py2=tob('瓶'), py3=tob('瓶').decode('latin1'))
d = d.decode()
self.assertFalse(d.recode_unicode)
self.assertTrue( | hasattr(list(d.keys())[0], 'encode')) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_formsdict.py | test_decode_method | self.assertTrue | func_call | 12 | import unittest
from bottle import FormsDict, touni, tob
class TestFormsDict(unittest.TestCase):
def test_decode_method(self):
d = FormsDict(py2=tob('瓶'), py3=tob('瓶').decode('latin1'))
d = d.decode()
self.assertFalse(d.recode_unicode)
self.assertTrue(hasattr(list(d.keys())[0], 'en... | hasattr(list(d.values())[0], 'encode')) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_importhook.py | test_direkt_import | self.assertEqual | variable | 17 | import unittest
import sys, os
import imp
class TestImportHooks(unittest.TestCase):
def make_module(self, name, **args):
mod = sys.modules.setdefault(name, imp.new_module(name))
mod.__file__ = '<virtual %s>' % name
mod.__dict__.update(**args)
return mod
def test_direkt_import(... | mod) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_importhook.py | test_data_import | self.assertEqual | string_literal | 17 | import unittest
import sys, os
import imp
class TestImportHooks(unittest.TestCase):
def make_module(self, name, **args):
mod = sys.modules.setdefault(name, imp.new_module(name))
mod.__file__ = '<virtual %s>' % name
mod.__dict__.update(**args)
return mod
def test_data_import(se... | 'value') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_importhook.py | test_import_fail | self.assertRaises | variable | 18 | import unittest
import sys, os
import imp
class TestImportHooks(unittest.TestCase):
def make_module(self, name, **args):
mod = sys.modules.setdefault(name, imp.new_module(name))
mod.__file__ = '<virtual %s>' % name
mod.__dict__.update(**args)
return mod
def test_import_fail(se... | ImportError) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_importhook.py | test_ext_isfile | self.assertTrue | func_call | 19 | import unittest
import sys, os
import imp
class TestImportHooks(unittest.TestCase):
def make_module(self, name, **args):
mod = sys.modules.setdefault(name, imp.new_module(name))
mod.__file__ = '<virtual %s>' % name
mod.__dict__.update(**args)
return mod
def test_ext_isfile(sel... | os.path.isfile(ext.__file__)) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_jinja2.py | test_template_shortcut | self.assertEqual | variable | 12 | import unittest
from bottle import Jinja2Template, jinja2_template, jinja2_view, touni
from tools import warn
from test.tools import chdir
class TestJinja2Template(unittest.TestCase):
def test_template_shortcut(self):
result = jinja2_template('start {{var}} end', var='middle')
self.assertEqual(t... | result) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_jinja2.py | test_view_decorator | self.assertEqual | func_call | 14 | import unittest
from bottle import Jinja2Template, jinja2_template, jinja2_view, touni
from tools import warn
from test.tools import chdir
class TestJinja2Template(unittest.TestCase):
def test_view_decorator(self):
@jinja2_view('start {{var}} end')
def test():
return dict(var='middle'... | test()) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_jinja2.py | test_notfound | self.assertRaises | variable | 12 | import unittest
from bottle import Jinja2Template, jinja2_template, jinja2_view, touni
from tools import warn
from test.tools import chdir
class TestJinja2Template(unittest.TestCase):
def test_notfound(self):
""" Templates: Unavailable templates"""
self.assertRaises( | Exception) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_jinja2.py | test_string | self.assertEqual | string_literal | 13 | import unittest
from bottle import Jinja2Template, jinja2_template, jinja2_view, touni
from tools import warn
from test.tools import chdir
class TestJinja2Template(unittest.TestCase):
def test_string(self):
""" Templates: Jinja2 string"""
t = Jinja2Template('start {{var}} end').render(var='var')
... | ''.join(t)) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_jinja2.py | test_custom_tests | self.assertEqual | func_call | 16 | import unittest
from bottle import Jinja2Template, jinja2_template, jinja2_view, touni
from tools import warn
from test.tools import chdir
class TestJinja2Template(unittest.TestCase):
def test_custom_tests(self):
"""Templates: jinja2 custom tests """
from bottle import jinja2_template as template... | t.render(var=2)) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_jinja2.py | test_custom_tests | self.assertEqual | func_call | 17 | import unittest
from bottle import Jinja2Template, jinja2_template, jinja2_view, touni
from tools import warn
from test.tools import chdir
class TestJinja2Template(unittest.TestCase):
def test_custom_tests(self):
"""Templates: jinja2 custom tests """
from bottle import jinja2_template as template... | t.render(var=1)) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_jinja2.py | test_custom_filters | self.assertEqual | func_call | 15 | import unittest
from bottle import Jinja2Template, jinja2_template, jinja2_view, touni
from tools import warn
from test.tools import chdir
class TestJinja2Template(unittest.TestCase):
def test_custom_filters(self):
"""Templates: jinja2 custom filters """
from bottle import jinja2_template as temp... | t.render(var="var")) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mako.py | test_string | self.assertEqual | variable | 11 | 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_string(self):
""" Templates: Mako string"""
t = MakoTemplate('start ${var} end').render(var='var')... | t) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mako.py | test_template_shortcut | self.assertEqual | variable | 11 | 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_template_shortcut(self):
result = mako_template('start ${var} end', var='middle')
self.assertEqu... | result) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mako.py | test_view_decorator | self.assertEqual | func_call | 13 | 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_view_decorator(self):
@mako_view('start ${var} end')
def test():
return dict(var='mid... | test()) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mako.py | test_notfound | self.assertRaises | variable | 11 | 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) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_isadict | self.assertEqual | func_call | 20 | 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... | len(m)) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_headergetbug | self.assertEqual | string_literal | 12 | 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'), | 'UPPER') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_headergetbug | self.assertEqual | string_literal | 13 | 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') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_isadict | self.assertRaises | variable | 23 | 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... | KeyError) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_isadict | self.assertEqual | string_literal | 21 | 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) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_isadict | self.assertEqual | string_literal | 22 | 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... | 'cay' in m) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_isadict | self.assertEqual | func_call | 16 | 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... | m.get('key')) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_ismulti | self.assertEqual | func_call | 11 | 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')) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_ismulti | self.assertEqual | func_call | 12 | 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')) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_isheader | self.assertEqual | func_call | 11 | 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')) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mdict.py | test_ismulti | self.assertEqual | func_call | 13 | 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'))
... | list(m.iterallitems())) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mount.py | test_mount_meta | self.assertEqual | string_literal | 18 | import bottle
from tools import ServerTestBase
from bottle import response
class TestAppMounting(ServerTestBase):
def setUp(self):
ServerTestBase.setUp(self)
self.subapp = bottle.Bottle()
@self.subapp.route('')
@self.subapp.route('/')
@self.subapp.route('/test/:test')
... | '/test/') | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mount.py | test_mount_meta | self.assertEqual | complex_expr | 20 | import bottle
from tools import ServerTestBase
from bottle import response
class TestAppMounting(ServerTestBase):
def setUp(self):
ServerTestBase.setUp(self)
self.subapp = bottle.Bottle()
@self.subapp.route('')
@self.subapp.route('/')
@self.subapp.route('/test/:test')
... | self.app) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_mount.py | test_mount_cookie | self.assertEqual | func_call | 23 | import bottle
from tools import ServerTestBase
from bottle import response
class TestAppMounting(ServerTestBase):
def setUp(self):
ServerTestBase.setUp(self)
self.subapp = bottle.Bottle()
@self.subapp.route('')
@self.subapp.route('/')
@self.subapp.route('/test/:test')
... | list(sorted(c.split(', ')))) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_oorouting.py | test_route1 | self.assertEqual | func_call | 18 | 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)) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_outputfilter.py | test_cookie | self.assertTrue | string_literal | 21 | import unittest
import bottle
from bottle import tob, touni
from tools import ServerTestBase, tobs, warn
class TestOutputFilter(ServerTestBase):
def test_cookie(self):
""" WSGI: Cookies """
@bottle.route('/cookie')
def test():
bottle.response.set_cookie('b', 'b')
bo... | 'b=b' in c) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_outputfilter.py | test_iterator_with_close | self.assertTrue | complex_expr | 24 | import unittest
import bottle
from bottle import tob, touni
from tools import ServerTestBase, tobs, warn
class TestOutputFilter(ServerTestBase):
def test_iterator_with_close(self):
class MyIter(object):
def __init__(self, data):
self.data = data
self.closed = Fa... | byte_iter.closed) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
bottlepy/bottle | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | train | train | test/test_outputfilter.py | test_fatal_error | self.assertRaises | variable | 12 | import unittest
import bottle
from bottle import tob, touni
from tools import ServerTestBase, tobs, warn
class TestOutputFilter(ServerTestBase):
def test_fatal_error(self):
@self.app.route('/')
def test(): raise KeyboardInterrupt()
self.assertRaises( | KeyboardInterrupt) | 5c5be34d65e7d9512bf2d6f1667565a5f14d64e9 | 203 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.