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
sqlalchemy/alembic
import os from os.path import join from unittest.mock import patch from alembic import util from alembic.testing import combinations from alembic.testing import expect_raises_message from alembic.testing.fixtures import TestBase class TestHelpers(TestBase): def common(self, cb, is_posix=True): with ( ...
[exes[0], "myfile"])
assert_*
collection
tests/test_editor.py
go
TestHelpers
61
null
sqlalchemy/alembic
from types import ModuleType from unittest import mock from alembic import testing from alembic import util from alembic.runtime.plugins import _all_plugins from alembic.runtime.plugins import _make_re from alembic.runtime.plugins import Plugin from alembic.testing import eq_ from alembic.testing.fixtures import TestB...
_all_plugins
assert
variable
tests/test_plugin.py
test_plugin_creation
PluginTest
38
null
sqlalchemy/alembic
from unittest.mock import MagicMock from unittest.mock import patch from sqlalchemy import Boolean from sqlalchemy import CheckConstraint from sqlalchemy import Column from sqlalchemy import Computed from sqlalchemy import event from sqlalchemy import exc from sqlalchemy import ForeignKey from sqlalchemy import Identi...
"ALTER TABLE t1 ADD COLUMN c1 INTEGER NOT NULL")
assert_*
string_literal
tests/test_op.py
test_add_column_multiple_fk_inline_references
OpTest
408
null
sqlalchemy/alembic
from configparser import RawConfigParser from contextlib import contextmanager import inspect from io import BytesIO from io import StringIO from io import TextIOWrapper import os import pathlib import re import shutil from typing import cast from sqlalchemy import exc as sqla_exc from sqlalchemy import text from sqla...
help_text
assert
variable
tests/test_command.py
test_help_text
CommandLineTest
1,389
null
sqlalchemy/alembic
import importlib.util from pathlib import Path import sys from alembic import command from alembic import testing from alembic import util from alembic.script import write_hooks from alembic.testing import assert_raises_message from alembic.testing import combinations from alembic.testing import eq_ from alembic.testi...
{"option": 1})
assert_*
collection
tests/test_post_write.py
test_invoke
HookTest
36
null
sqlalchemy/alembic
from contextlib import contextmanager import re from sqlalchemy import Boolean from sqlalchemy import CheckConstraint from sqlalchemy import Column from sqlalchemy import Computed from sqlalchemy import DateTime from sqlalchemy import Enum from sqlalchemy import ForeignKey from sqlalchemy import ForeignKeyConstraint f...
batch.impl.operations.impl.mock_calls
assert
complex_expr
tests/test_batch.py
test_add_col
BatchAPITest
936
null
sqlalchemy/alembic
from sqlalchemy.testing import util as sqla_testing_util from alembic.script.revision import CycleDetected from alembic.script.revision import DependencyCycleDetected from alembic.script.revision import DependencyLoopDetected from alembic.script.revision import LoopDetected from alembic.script.revision import Multiple...
self.map.iterate_revisions("b1", "d1cb1"))
assert_*
func_call
tests/test_revision.py
test_same_branch_wrong_direction
MultipleBranchTest
536
null
sqlalchemy/alembic
import io from ...migration import MigrationContext from ...testing import assert_raises from ...testing import config from ...testing import eq_ from ...testing import is_ from ...testing import is_false from ...testing import is_not_ from ...testing import is_true from ...testing import ne_ from ...testing.fixtures ...
go)
assert_*
variable
alembic/testing/suite/test_environment.py
test_proxy_transaction_contextmanager_rollback
MigrationTransactionTest
81
null
sqlalchemy/alembic
import importlib.util from pathlib import Path import sys from alembic import command from alembic import testing from alembic import util from alembic.script import write_hooks from alembic.testing import assert_raises_message from alembic.testing import combinations from alembic.testing import eq_ from alembic.testi...
self.cfg)
assert_*
complex_expr
tests/test_post_write.py
test_no_type
RunHookTest
145
null
sqlalchemy/alembic
import io import logging import os import pathlib import sys import tempfile from alembic import command from alembic import config from alembic import testing from alembic import util from alembic.migration import MigrationContext from alembic.operations import Operations from alembic.script import ScriptDirectory fr...
["Revision abc42 frobnicated."]
assert
collection
tests/test_config.py
test_register_command
CommandLineTest
778
null
sqlalchemy/alembic
from __future__ import annotations from contextlib import contextmanager import os import re import shutil import textwrap from typing import Dict from typing import List import sqlalchemy as sa from sqlalchemy import pool from alembic import command from alembic import testing from alembic import util from alembic....
{}
assert
collection
tests/test_script_consumption.py
test_steps
CallbackEnvironmentTest
384
null
sqlalchemy/alembic
import importlib.machinery import logging import os from pathlib import Path import shutil import textwrap from sqlalchemy.testing import config from sqlalchemy.testing import provision from . import util as testing_util from .. import command from .. import script from .. import util from ..script import Script from...
( "pep3147_envonly", "simple", "pep3147_everything", )
assert
collection
alembic/testing/env.py
staging_env
68
null
sqlalchemy/alembic
from alembic import util from alembic.migration import HeadMaintainer from alembic.migration import MigrationStep from alembic.testing import assert_raises_message from alembic.testing import eq_ from alembic.testing import expect_warnings from alembic.testing import mock from alembic.testing.env import clear_staging_e...
self.b.revision)
assert_*
complex_expr
tests/test_version_traversal.py
test_invalid_relative_upgrade_path
RevisionPathTest
122
null
sqlalchemy/alembic
import datetime import os from pathlib import Path import re from unittest.mock import patch import sqlalchemy as sa from sqlalchemy import Column from sqlalchemy import DateTime from sqlalchemy import ForeignKey from sqlalchemy import inspect from sqlalchemy import Integer from sqlalchemy import MetaData from sqlalch...
result
assert
variable
tests/test_script_production.py
test_programmatic_command_option
CustomizeRevisionTest
750
null
sqlalchemy/alembic
from sqlalchemy.testing import util as sqla_testing_util from alembic.script.revision import CycleDetected from alembic.script.revision import DependencyCycleDetected from alembic.script.revision import DependencyLoopDetected from alembic.script.revision import LoopDetected from alembic.script.revision import Multiple...
"abranch@d")
assert_*
string_literal
tests/test_revision.py
test_rev_not_in_branch
LabeledBranchTest
429
null
sqlalchemy/alembic
from sqlalchemy import Column from sqlalchemy import inspect from sqlalchemy import Integer from sqlalchemy import MetaData from sqlalchemy import PrimaryKeyConstraint from sqlalchemy import String from sqlalchemy import Table from sqlalchemy.dialects import registry from sqlalchemy.engine import default from alembic ...
context.get_current_revision)
assert_*
complex_expr
tests/test_version_table.py
test_get_current_revision_error_if_starting_rev_given_online
TestMigrationContext
117
null
sqlalchemy/alembic
from contextlib import contextmanager import re from sqlalchemy import Boolean from sqlalchemy import CheckConstraint from sqlalchemy import Column from sqlalchemy import Computed from sqlalchemy import DateTime from sqlalchemy import Enum from sqlalchemy import ForeignKey from sqlalchemy import ForeignKeyConstraint f...
None
assert
none_literal
tests/test_batch.py
test_no_net_change_timestamp_w_default
BatchRoundTripTest
1,520
null
sqlalchemy/alembic
from contextlib import contextmanager import re from sqlalchemy import Boolean from sqlalchemy import CheckConstraint from sqlalchemy import Column from sqlalchemy import Computed from sqlalchemy import DateTime from sqlalchemy import Enum from sqlalchemy import ForeignKey from sqlalchemy import ForeignKeyConstraint f...
go)
assert_*
variable
tests/test_batch.py
test_add_column_insert_before_raise_on_alter
BatchRoundTripTest
2,240
null
sqlalchemy/alembic
from sqlalchemy.testing import util as sqla_testing_util from alembic.script.revision import CycleDetected from alembic.script.revision import DependencyCycleDetected from alembic.script.revision import DependencyLoopDetected from alembic.script.revision import LoopDetected from alembic.script.revision import Multiple...
self.map.iterate_revisions(["db1", "b2", "fe1b1"], ()))
assert_*
func_call
tests/test_revision.py
test_detect_invalid_head_selection
BranchTravellingTest
773
null
sqlalchemy/alembic
import importlib.util from pathlib import Path import sys from alembic import command from alembic import testing from alembic import util from alembic.script import write_hooks from alembic.testing import assert_raises_message from alembic.testing import combinations from alembic.testing import eq_ from alembic.testi...
write_hooks._registry
assert
complex_expr
tests/test_post_write.py
test_register
HookTest
28
null
lona-web-org/lona
from lona.html import Div def test_state(): div = Div() assert hasattr(div, 'state') assert hasattr(div.state, 'lock') assert div.state == {} div.state['foo'] = 'bar' assert div.state ==
{'foo': 'bar'}
assert
collection
tests/test_0106_html_state.py
test_state
14
null
lona-web-org/lona
import pytest from lona.html import HTML1, Span, Div, H1 def test_query_selector(): # test selectors by tag name html = Div( HTML1(), 'foo', Div( H1(), ), Span(), Div(), ) assert html.query_selector('h1') is html[2][0] assert html.query...
html[3]
assert
complex_expr
tests/test_0105_html_query_selectors.py
test_query_selector
24
null
lona-web-org/lona
import pytest from lona.html import Div def test_nodes_in_nodes(): div1 = Div() div2 = Div( div1, ) assert len(div2) ==
1
assert
numeric_literal
tests/test_0103_html_sub_nodes.py
test_nodes_in_nodes
13
null
lona-web-org/lona
def save_message(message_list): def _save_message(message): if message.topic.startswith('lona.'): return message_list.append(message) if message.data.get('crash', False): raise RuntimeError() return _save_message def do_nothing(*args, **kwargs): pass asyn...
1
assert
numeric_literal
tests/test_channels.py
test_message_integrity
112
null
lona-web-org/lona
async def test_multi_tab_daemon_view(lona_app_context): """ This test tests the HTML synchronization between two tabs that show same, daemonized view, using a TextInput """ from playwright.async_api import async_playwright from lona.pytest import eventually def setup_app(app): fro...
'bar'
assert
string_literal
tests/test_daemon_views.py
test_multi_tab_daemon_view
167
null
lona-web-org/lona
import pytest @pytest.mark.parametrize('client_version', [1, 2]) @pytest.mark.parametrize('browser_name', ['chromium', 'firefox', 'webkit']) async def test_input_events( browser_name, client_version, lona_project_context, ): """ This test tests all available input event types using the...
''
assert
string_literal
tests/test_0305_events.py
test_input_events
68
null
lona-web-org/lona
import re import pytest from lona.html import Div def test_pop_unknown_key_with_default(): d = Div(foo='foo-val', bar='bar-val') assert 'xxx' not in d.attributes val = d.attributes.pop('xxx', 'yyy') assert val ==
'yyy'
assert
string_literal
tests/test_0101_html_attribute_dict.py
test_pop_unknown_key_with_default
87
null
lona-web-org/lona
def save_message(message_list): def _save_message(message): if message.topic.startswith('lona.'): return message_list.append(message) if message.data.get('crash', False): raise RuntimeError() return _save_message def do_nothing(*args, **kwargs): pass asyn...
'test2'
assert
string_literal
tests/test_channels.py
test_view_api
351
null
lona-web-org/lona
import re import pytest from lona.html import Div def test_pop_expects_at_most_2_arguments(): d = Div(foo='foo-val', bar='bar-val') with pyt
TypeError, match='pop expected at most 2 arguments, got 3')
pytest.raises
complex_expr
tests/test_0101_html_attribute_dict.py
test_pop_expects_at_most_2_arguments
104
null
lona-web-org/lona
import pytest from lona.html import Div def test_nodes_in_nodes(): div1 = Div() div2 = Div( div1, ) assert len(div2) == 1 assert div2[0] is
div1
assert
variable
tests/test_0103_html_sub_nodes.py
test_nodes_in_nodes
14
null
lona-web-org/lona
import pytest from lona.html import Div def test_remove_existing_element(): d = Div(_id='foo bar') d.id_list.remove('foo') assert d.id_list ==
['bar']
assert
collection
tests/test_0102_html_attribute_list.py
test_remove_existing_element
197
null
lona-web-org/lona
def test_select(): import pytest from lona.html import Select, Option # basic API ############################################################### select = Select( values=[ ('foo', 'Foo'), ('bar', 'Bar'), ('baz', 'Baz'), ], ) assert not selec...
3
assert
numeric_literal
tests/test_0202_html_select.py
test_select
18
null
lona-web-org/lona
def save_message(message_list): def _save_message(message): if message.topic.startswith('lona.'): return message_list.append(message) if message.data.get('crash', False): raise RuntimeError() return _save_message def do_nothing(*args, **kwargs): pass asyn...
0
assert
numeric_literal
tests/test_channels.py
test_message_expiry
78
null
lona-web-org/lona
import pytest @pytest.mark.parametrize('client_version', [1, 2]) @pytest.mark.parametrize('browser_name', ['chromium', 'firefox', 'webkit']) async def test_rendering(browser_name, client_version, lona_project_context): """ This test tests all client side rendering features, using the rendering test view in...
'1px'
assert
string_literal
tests/test_0304_rendering.py
test_rendering
135
null
lona-web-org/lona
import pytest async def check_empty_client_style(page): client_style = await get_client_style(page) assert 'top' not in
client_style
assert
variable
tests/test_0304_rendering.py
check_empty_client_style
73
null
lona-web-org/lona
import pytest from lona.html import HTML1, Span, Div, H1 def test_unsupported_selector(): with pytest.raises(
ValueError, match='unsupported selector feature:*')
pytest.raises
complex_expr
tests/test_0105_html_query_selectors.py
test_unsupported_selector
7
null
lona-web-org/lona
import os.path from playwright.async_api import async_playwright from lona.static_files import StyleSheet, Script from lona.html import Div from lona import View def setup_app(app): some_existing_file = os.path.basename(__file__) class MyNode(Div): STATIC_FILES = [ StyleSheet( ...
200
assert
numeric_literal
tests/test_static_files_nodes.py
test_static_files_nodes
48
null
lona-web-org/lona
import os.path from playwright.async_api import async_playwright from lona.static_files import StyleSheet, Script from lona import View def setup_app(app): some_existing_file = os.path.basename(__file__) @app.route('/') class MyView(View): STATIC_FILES = [ StyleSheet( ...
200
assert
numeric_literal
tests/test_static_files_view.py
test_static_files_view
46
null
lona-web-org/lona
def setup_app(app): from datetime import datetime from lona import View @app.route('/') class HoweView(View): def handle_request(self, request): return 'HOME' @app.route('/daemonized-view/') class DaemonizedView(View): def handle_request(self, request): ...
timestamp
assert
variable
tests/test_title.py
test_title
52
null
lona-web-org/lona
import pytest @pytest.mark.parametrize('client_version', [1, 2]) @pytest.mark.parametrize('browser_name', ['chromium', 'firefox', 'webkit']) async def test_input_events( browser_name, client_version, lona_project_context, ): """ This test tests all available input event types using the...
[]
assert
collection
tests/test_0305_events.py
test_input_events
158
null
lona-web-org/lona
import os.path from playwright.async_api import async_playwright from lona.static_files import StyleSheet, Script from lona.html import Div from lona import View def setup_app(app): some_existing_file = os.path.basename(__file__) class MyNode(Div): STATIC_FILES = [ StyleSheet( ...
html
assert
variable
tests/test_static_files_nodes.py
test_static_files_nodes
69
null
lona-web-org/lona
def save_message(message_list): def _save_message(message): if message.topic.startswith('lona.'): return message_list.append(message) if message.data.get('crash', False): raise RuntimeError() return _save_message def do_nothing(*args, **kwargs): pass asyn...
2
assert
numeric_literal
tests/test_channels.py
test_view_api
350
null
lona-web-org/lona
import pytest from lona.html import Div def test_mixed_nodes(): sub_node1 = Div() sub_node2 = Div() div = Div( sub_node1, 'foo', sub_node2, 'bar', ) assert len(div) == 4 assert div[0] is
sub_node1
assert
variable
tests/test_0103_html_sub_nodes.py
test_mixed_nodes
36
null
lona-web-org/lona
from lona.html import NumberInput, HTML1 def test_parsing_int_value(): node = HTML1('<input type="number" value="123"/>')[0] assert node.value ==
123
assert
numeric_literal
tests/test_0201_number_input.py
test_parsing_int_value
38
null
lona-web-org/lona
import pytest from lona.html import ( NumberInput, TextInput, TextArea, CheckBox, Select2, Option2, Submit, Select, Option, Button, HTML2, HTML1, Node, Div, ) from lona.compat import set_use_future_node_classes def test_sub_nodes(): node = HTML1(""" ...
3
assert
numeric_literal
tests/test_0104_html_parsing.py
test_sub_nodes
58
null
lona-web-org/lona
import pytest async def get_frontend_uptime(page): return (await page.locator('#application-started').all_text_contents())[0] async def get_exception_info(page): info = { 'type': '', 'args': '', } await page.wait_for_selector('#lona h2:has-text("500")') info['type'] = ( a...
200
assert
numeric_literal
tests/test_0302_responses.py
test_non_interactive_responses
161
null
lona-web-org/lona
async def test_multi_tab_daemon_view(lona_app_context): """ This test tests the HTML synchronization between two tabs that show same, daemonized view, using a TextInput """ from playwright.async_api import async_playwright from lona.pytest import eventually def setup_app(app): fro...
'initial'
assert
string_literal
tests/test_daemon_views.py
test_multi_tab_daemon_view
149
null
lona-web-org/lona
def save_message(message_list): def _save_message(message): if message.topic.startswith('lona.'): return message_list.append(message) if message.data.get('crash', False): raise RuntimeError() return _save_message def do_nothing(*args, **kwargs): pass asyn...
'test1'
assert
string_literal
tests/test_channels.py
test_message_integrity
122
null
lona-web-org/lona
import pytest from lona.routing import Router, Route class TestBasicRouting: def setup_method(self): self.routes = [ Route('/foo/<arg>/', None), Route('/foo/', None), Route('/bar/<arg>/', None), Route('/', None), ] self.router = Router() ...
self.routes[1]
assert
complex_expr
tests/test_0301_routing.py
test_resolve_without_arguments
TestBasicRouting
22
null
lona-web-org/lona
from lona.html import Widget, Span, Node, Div from lona.html.text_node import TextNode def test_legacy_widgets(): # TODO: remove in 2.0 class TestWidget(Widget): def __init__(self, *nodes, **widget_data): self.nodes = nodes self.data = widget_data assert TestWidget() ==
TestWidget()
assert
func_call
tests/test_0107_html_node_compare.py
test_legacy_widgets
26
null
lona-web-org/lona
from lona.exceptions import UserAbort from lona.pytest import eventually from lona.html import Button from lona import View def setup_app(app): @app.route('/') class HomeView(View): def handle_request(self, request): return 'HOME' @app.route('/test-view/') class TestView(View): ...
[]
assert
collection
tests/test_view_stop_hooks.py
test_view_stop_hooks
55
null
lona-web-org/lona
from lona.html import Widget, Span, Node, Div from lona.html.text_node import TextNode def test_simple_comparison(): assert Div() == Div() assert Div() is not Div() assert Div() !=
Widget()
assert
func_call
tests/test_0107_html_node_compare.py
test_simple_comparison
8
null
lona-web-org/lona
from tempfile import TemporaryDirectory import string import random import uuid import os from playwright.async_api import async_playwright import aiohttp from lona.pytest import eventually from lona import Bucket, View async def test_buckets(lona_app_context): # test state upload_temp_dir = TemporaryDirect...
200
assert
numeric_literal
tests/test_600_buckets.py
test_buckets
181
null
lona-web-org/lona
from lona.html import NumberInput, HTML1 def test_parsing_all_attributes(): node = HTML1( '<input type="number" value="12.3" min="15.3" max="20.5" step="0.2"/>', )[0] assert node.value == 12.3 assert node.min == 15.3 assert node.max == 20.5 assert node.step ==
0.2
assert
numeric_literal
tests/test_0201_number_input.py
test_parsing_all_attributes
83
null
lona-web-org/lona
from lona.html import Widget, Span, Node, Div from lona.html.text_node import TextNode def test_tag_name(): assert Div() !=
Span()
assert
func_call
tests/test_0107_html_node_compare.py
test_tag_name
48
null
lona-web-org/lona
from lona.html import Widget, Span, Node, Div from lona.html.text_node import TextNode def test_attributes(): assert Div(a=1) == Div(a=1) assert Div(a=1) !=
Div(a=2)
assert
func_call
tests/test_0107_html_node_compare.py
test_attributes
72
null
lona-web-org/lona
def setup_app(app): from lona.html import TextInput, FOCUS from lona import View @app.route('/') class MyView(View): def handle_request(self, request): self.show(TextInput(events=[FOCUS])) self.await_focus() self.show('SUCCESS') async def test_focus_events(l...
'SUCCESS'
assert
string_literal
tests/test_focus_events.py
test_focus_events
24
null
lona-web-org/lona
def test_select(): import pytest from lona.html import Select, Option # basic API ############################################################### select = Select( values=[ ('foo', 'Foo'), ('bar', 'Bar'), ('baz', 'Baz'), ], ) assert not selec...
'bar'
assert
string_literal
tests/test_0202_html_select.py
test_select
35
null
lona-web-org/lona
import pytest from lona.html import Div def test_mixed_nodes(): sub_node1 = Div() sub_node2 = Div() div = Div( sub_node1, 'foo', sub_node2, 'bar', ) assert len(div) == 4 assert div[0] is sub_node1 assert str(div[1]) == 'foo' assert div[2] is
sub_node2
assert
variable
tests/test_0103_html_sub_nodes.py
test_mixed_nodes
38
null
lona-web-org/lona
import pytest from lona.html import ( NumberInput, TextInput, TextArea, CheckBox, Select2, Option2, Submit, Select, Option, Button, HTML2, HTML1, Node, Div, ) from lona.compat import set_use_future_node_classes def test_empty_node(): node = HTML1('<div></div...
{}
assert
collection
tests/test_0104_html_parsing.py
test_empty_node
29
null
lona-web-org/lona
from __future__ import annotations from tempfile import TemporaryDirectory from argparse import Namespace from typing import List import os TEST_PROJECT_PATH = os.path.join( os.path.dirname(__file__), '../test_project', ) def _generate_command_line_args( destination: str, clean: bool = False,...
original
assert
variable
tests/test_collect_static.py
_check_javascript_client_src_files
63
null
lona-web-org/lona
import pytest from lona.html import Div def test_generator(): div = Div( (Div() for i in range(10)), ) assert len(div) ==
10
assert
numeric_literal
tests/test_0103_html_sub_nodes.py
test_generator
47
null
lona-web-org/lona
from lona.html import Widget, Span, Node, Div from lona.html.text_node import TextNode def test_id_list(): assert Div(_id='foo') ==
Div(_id='foo')
assert
func_call
tests/test_0107_html_node_compare.py
test_id_list
53
null
lona-web-org/lona
def save_message(message_list): def _save_message(message): if message.topic.startswith('lona.'): return message_list.append(message) if message.data.get('crash', False): raise RuntimeError() return _save_message def do_nothing(*args, **kwargs): pass asyn...
True
assert
bool_literal
tests/test_channels.py
test_internal_topics
276
null
lona-web-org/lona
import pytest async def get_frontend_uptime(page): return (await page.locator('#application-started').all_text_contents())[0] async def get_exception_info(page): info = { 'type': '', 'args': '', } await page.wait_for_selector('#lona h2:has-text("500")') info['type'] = ( a...
frontend_uptime
assert
variable
tests/test_0302_responses.py
test_interactive_responses
90
null
lona-web-org/lona
from lona.html import Widget, Span, Node, Div from lona.html.text_node import TextNode def test_simple_comparison(): assert Div() == Div() assert Div() is not Div() assert Div() != Widget() assert Div() !=
TextNode('')
assert
func_call
tests/test_0107_html_node_compare.py
test_simple_comparison
9
null
lona-web-org/lona
import re import pytest from lona.html import Div def test_pop_unknown_key(): d = Div(foo='foo-val', bar='bar-val') assert 'xxx' not in d.attributes with pytest.raises(
KeyError, match='xxx')
pytest.raises
complex_expr
tests/test_0101_html_attribute_dict.py
test_pop_unknown_key
76
null
lona-web-org/lona
import os.path from playwright.async_api import async_playwright from lona.static_files import StyleSheet, Script from lona import View def setup_app(app): some_existing_file = os.path.basename(__file__) @app.route('/') class MyView(View): STATIC_FILES = [ StyleSheet( ...
404
assert
numeric_literal
tests/test_static_files_view.py
test_static_files_view
49
null
lona-web-org/lona
from lona.pytest import eventually from lona import View def setup_app(app): @app.route('/view-1/') class View1(View): def handle_request(self, request): if 'fire' in request.GET: self.fire_view_event('view1', {'view1': True}) def on_view_event(self, view_event): ...
[ ('broadcast', {'broadcast': True}), ('broadcast', {'broadcast': True}), ('broadcast', {'broadcast': True}), ('view2', {'view2': True}), ('view2', {'view2': True}), ('view2', {'view2': True}), ]
assert
collection
tests/test_view_events.py
test_view_events
91
null
lona-web-org/lona
async def test_view_sleep(lona_project_context): import os from playwright.async_api import async_playwright from lona.pytest import eventually TEST_PROJECT_PATH = os.path.join(__file__, '../../test_project') context = await lona_project_context( project_root=TEST_PROJECT_PATH, s...
'-'
assert
string_literal
tests/test_view_sleep.py
test_view_sleep
30
null
lona-web-org/lona
async def test_simple_daemon_view(lona_app_context): """ This test tests if a the state a daemonized view is hold by the server over page refreshes, until the view gets stopped by the user. """ from playwright.async_api import async_playwright from lona.pytest import eventually def setup_...
message2
assert
variable
tests/test_daemon_views.py
test_simple_daemon_view
78
null
lona-web-org/lona
def test_select2(): import pytest from lona.html import Select2, Option2 # basic API ############################################################### select = Select2( Option2('Foo', value='foo'), Option2('Bar', value='bar'), Option2('Baz', value='baz'), ) assert not se...
0
assert
numeric_literal
tests/test_0203_html_select2.py
test_select2
195
null
lona-web-org/lona
import re import pytest from lona.html import Div def test_value_cant_be_dict(): with pyt
ValueError, match="unsupported type: <class 'dict'>")
pytest.raises
complex_expr
tests/test_0101_html_attribute_dict.py
test_value_cant_be_dict
30
null
lona-web-org/lona
import pytest async def get_frontend_uptime(page): return (await page.locator('#application-started').all_text_contents())[0] async def get_exception_info(page): info = { 'type': '', 'args': '', } await page.wait_for_selector('#lona h2:has-text("500")') info['type'] = ( a...
''
assert
string_literal
tests/test_0302_responses.py
test_non_interactive_responses
162
null
lona-web-org/lona
from lona.html import Widget, Span, Node, Div from lona.html.text_node import TextNode def test_non_node_comparisons(): assert Div() != 'Div' assert Div() !=
object()
assert
func_call
tests/test_0107_html_node_compare.py
test_non_node_comparisons
39
null
lona-web-org/lona
import pytest from lona.routing import Router, Route class TestReverseMatching: def setup_method(self): routes = [ Route('/foo/<arg>/', None, name='foo'), Route('/bar/', None, name='bar'), Route('/foobar/<arg>(/)', None, name='foobar'), ] self.router = R...
'/foo/bar/'
assert
string_literal
tests/test_0301_routing.py
test_reverse_with_arg
TestReverseMatching
139
null
lona-web-org/lona
import pytest from lona.html import RadioButton, RadioGroup, Label, Div from lona.html.text_node import TextNode def test_values(): # no value radio_group = RadioGroup( RadioButton(value='foo'), RadioButton(value='bar'), RadioButton(value='baz'), ) assert radio_group.value is...
'foo'
assert
string_literal
tests/test_0204_html_radio_buttons.py
test_values
28
null
lona-web-org/lona
from lona.html import Widget, Span, Node, Div from lona.html.text_node import TextNode def test_attributes(): assert Div(a=1) ==
Div(a=1)
assert
func_call
tests/test_0107_html_node_compare.py
test_attributes
71
null
lona-web-org/lona
import pytest from lona.html import Div def test_default_id_list_is_empty(): d = Div() assert d.id_list ==
[]
assert
collection
tests/test_0102_html_attribute_list.py
test_default_id_list_is_empty
9
null
lona-web-org/lona
from playwright.async_api import async_playwright from lona.html import NumberInput, Select, HTML from lona.pytest import eventually from lona import View async def test_number_inputs(lona_app_context): test_data = {} def setup_app(app): @app.route('/') class NumberInputView(View): ...
10
assert
numeric_literal
tests/test_0403_number_input.py
test_number_inputs
54
null
lona-web-org/lona
import pytest @pytest.mark.parametrize('client_version', [1, 2]) @pytest.mark.parametrize('browser_name', ['chromium', 'firefox', 'webkit']) async def test_input_events( browser_name, client_version, lona_project_context, ): """ This test tests all available input event types using the...
1
assert
numeric_literal
tests/test_0305_events.py
test_input_events
143
null
lona-web-org/lona
def setup_app(app): from datetime import datetime from lona import View @app.route('/') class HoweView(View): def handle_request(self, request): return 'HOME' @app.route('/daemonized-view/') class DaemonizedView(View): def handle_request(self, request): ...
'Daemonized View'
assert
string_literal
tests/test_title.py
test_title
46
null
lona-web-org/lona
import pytest @pytest.mark.parametrize('client_version', [1, 2]) @pytest.mark.parametrize('browser_name', ['chromium', 'firefox', 'webkit']) async def test_input_events( browser_name, client_version, lona_project_context, ): """ This test tests all available input event types using the...
()
assert
collection
tests/test_0305_events.py
test_input_events
177
null
lona-web-org/lona
from lona.html import Widget, Span, Node, Div from lona.html.text_node import TextNode def test_attributes(): assert Div(a=1) == Div(a=1) assert Div(a=1) != Div(a=2) assert Div(a=1) !=
Div(a=1, b=2)
assert
func_call
tests/test_0107_html_node_compare.py
test_attributes
73
null
lona-web-org/lona
import pytest from lona.routing import Router, Route class TestRoutesWithRegex: def setup_method(self): self.routes = [ Route('/number/<number:[0-9]+>/', None), ] self.router = Router() self.router.add_routes(*self.routes) def test_match_regex(self): match...
{'number': '14'}
assert
collection
tests/test_0301_routing.py
test_match_regex
TestRoutesWithRegex
66
null
lona-web-org/lona
import pytest from lona.html import Div def test_slices(): div1 = Div() div2 = Div() div3 = Div() div4 = Div() outer_div = Div(div1, div2, div3, div4) outer_div.nodes = outer_div[1:-1] assert div1 not in
outer_div
assert
variable
tests/test_0103_html_sub_nodes.py
test_slices
66
null
lona-web-org/lona
import pytest from lona.html import Div def test_text_nodes_in_nodes(): div = Div('foo') assert len(div) == 1 assert str(div[0]) ==
'foo'
assert
string_literal
tests/test_0103_html_sub_nodes.py
test_text_nodes_in_nodes
21
null
lona-web-org/lona
import pytest async def get_frontend_uptime(page): return (await page.locator('#application-started').all_text_contents())[0] async def get_exception_info(page): info = { 'type': '', 'args': '', } await page.wait_for_selector('#lona h2:has-text("500")') info['type'] = ( a...
'RuntimeError'
assert
string_literal
tests/test_0302_responses.py
test_interactive_responses
113
null
lona-web-org/lona
import pytest from lona.html import Div def test_default_list_has_zero_len(): d = Div() assert len(d.id_list) ==
0
assert
numeric_literal
tests/test_0102_html_attribute_list.py
test_default_list_has_zero_len
101
null
lona-web-org/lona
from lona.pytest import eventually from lona import View def setup_app(app): @app.route('/view-1/') class View1(View): def handle_request(self, request): if 'fire' in request.GET: self.fire_view_event('view1', {'view1': True}) def on_view_event(self, view_event): ...
[ ('broadcast', {'broadcast': True}), ('broadcast', {'broadcast': True}), ('broadcast', {'broadcast': True}), ('view1', {'view1': True}), ('view1', {'view1': True}), ('view1', {'view1': True}), ]
assert
collection
tests/test_view_events.py
test_view_events
82
null
lona-web-org/lona
import pytest from lona.routing import Router, Route class TestBasicRouting: def setup_method(self): self.routes = [ Route('/foo/<arg>/', None), Route('/foo/', None), Route('/bar/<arg>/', None), Route('/', None), ] self.router = Router() ...
self.routes[0]
assert
complex_expr
tests/test_0301_routing.py
test_resolve_with_argument
TestBasicRouting
29
null
lona-web-org/lona
import pytest from lona.html import Div def test_add_one_element(): d = Div() d.id_list.add('foo') assert d.id_list ==
['foo']
assert
collection
tests/test_0102_html_attribute_list.py
test_add_one_element
154
null
lona-web-org/lona
def setup_app(app): from lona.html import TextInput, HTML, BLUR from lona import View @app.route('/') class MyView(View): def handle_request(self, request): html = HTML( TextInput(events=[BLUR], _id='first'), TextInput(_id='second'), ) ...
'SUCCESS'
assert
string_literal
tests/test_blur_events.py
test_blur_events
30
null
lona-web-org/lona
def test_select2(): import pytest from lona.html import Select2, Option2 # basic API ############################################################### select = Select2( Option2('Foo', value='foo'), Option2('Bar', value='bar'), Option2('Baz', value='baz'), ) assert not se...
3
assert
numeric_literal
tests/test_0203_html_select2.py
test_select2
55
null
lona-web-org/lona
import pytest from lona.html import HTML1, Span, Div, H1 def test_query_selector_all(): html = Div( Span(), Div( Span(), ), Span(), ) nodes = html.query_selector_all('span') assert len(nodes) ==
3
assert
numeric_literal
tests/test_0105_html_query_selectors.py
test_query_selector_all
80
null
lona-web-org/lona
async def test_post_requests(lona_app_context): """ This test checks if <form>-requests as GET and POST work as intended. """ import json from playwright.async_api import async_playwright from lona.html import TextInput, Submit, HTML, Form, Div from lona import View def setup_app(app...
{'input-1': 'foo'}
assert
collection
tests/test_0306_requests.py
test_post_requests
60
null
lona-web-org/lona
import pytest from lona.html import Div def test_mixed_nodes(): sub_node1 = Div() sub_node2 = Div() div = Div( sub_node1, 'foo', sub_node2, 'bar', ) assert len(div) == 4 assert div[0] is sub_node1 assert str(div[1]) == 'foo' assert div[2] is sub_node2 ...
'bar'
assert
string_literal
tests/test_0103_html_sub_nodes.py
test_mixed_nodes
39
null
lona-web-org/lona
from tempfile import TemporaryDirectory import string import random import uuid import os from playwright.async_api import async_playwright import aiohttp from lona.pytest import eventually from lona import Bucket, View async def test_buckets(lona_app_context): # test state upload_temp_dir = TemporaryDirect...
[]
assert
collection
tests/test_600_buckets.py
test_buckets
187
null
lona-web-org/lona
import pytest from lona.html import HTML1, Span, Div, H1 def test_query_selector(): # test selectors by tag name html = Div( HTML1(), 'foo', Div( H1(), ), Span(), Div(), ) assert html.query_selector('h1') is
html[2][0]
assert
complex_expr
tests/test_0105_html_query_selectors.py
test_query_selector
23
null
lona-web-org/lona
import re import pytest from lona.html import Div def test_pop_existing_key_with_default(): d = Div(foo='foo-val', bar='bar-val') assert 'bar' in d.attributes val = d.attributes.pop('bar', 'yyy') assert val ==
'bar-val'
assert
string_literal
tests/test_0101_html_attribute_dict.py
test_pop_existing_key_with_default
97
null