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 |
|---|---|---|---|---|---|---|---|---|---|
lightning-power-users/node-launcher | from unittest.mock import MagicMock, patch
import pytest
from PySide6.QtTest import QTest
from PySide6.QtWidgets import QApplication
from node_launcher.gui.menu.menu import Menu
def menu() -> Menu:
system_tray = MagicMock()
node_set = MagicMock()
node_set.tor_node.network = 'tor'
node_set.bitcoind_no... | 'test macaroon') | assert_* | string_literal | tests/test_gui/test_menu/test_menu.py | test_joule_macaroons_action | TestMenu | 40 | null |
lightning-power-users/node-launcher | import os
from tempfile import mkdtemp
import pytest
from node_launcher.node_set.lnd.lnd_configuration import LndConfiguration
from node_launcher.port_utilities import is_port_in_use
def lnd_configuration() -> LndConfiguration:
tmpdirname = mkdtemp()
os.rmdir(tmpdirname)
configuration_path = os.path.join... | 9835 | assert | numeric_literal | tests/test_node_set/test_lnd/test_lnd_configuration.py | test_multi_listen | TestDirectoryConfiguration | 38 | null |
lightning-power-users/node-launcher | import os
import shutil
from shutil import make_archive
import pytest
from node_launcher.constants import IS_WINDOWS
from node_launcher.node_set.lib.constants import (
DEFAULT_COMPRESSED_SUFFIX,
DEFAULT_WINDOWS_COMPRESSED_SUFFIX
)
from node_launcher.node_set.lib.node_status import SoftwareStatus
from node_lau... | DEFAULT_COMPRESSED_SUFFIX | assert | variable | tests/test_node_set/test_lib/test_software.py | test__init__ | TestSoftware | 71 | null |
lightning-power-users/node-launcher | import pytest
from node_launcher.node_set.lib.hard_drives import HardDrives
def hard_drives():
hard_drives = HardDrives()
return hard_drives
class TestHardDrives(object):
def test_get_big_drive(self, hard_drives: HardDrives):
assert hard_drives.get_big_drive().gb_free > | 0 | assert | numeric_literal | tests/test_node_set/test_bitcoind/test_hard_drives.py | test_get_big_drive | TestHardDrives | 14 | null |
lightning-power-users/node-launcher | from unittest.mock import MagicMock
from tempfile import NamedTemporaryFile
import pytest
from node_launcher.gui.menu.nodes_manage.manage_dialogs.configuration import ConfigurationDialog
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import Co... | 1 | assert | numeric_literal | tests/test_gui/test_menu/test_node_manager/test_configuration_dialog.py | test_append_key_value | TestConfigurationDialog | 34 | null |
lightning-power-users/node-launcher | import os
import shutil
from shutil import make_archive
import pytest
from node_launcher.constants import IS_WINDOWS
from node_launcher.node_set.lib.constants import (
DEFAULT_COMPRESSED_SUFFIX,
DEFAULT_WINDOWS_COMPRESSED_SUFFIX
)
from node_launcher.node_set.lib.node_status import SoftwareStatus
from node_lau... | DEFAULT_WINDOWS_COMPRESSED_SUFFIX | assert | variable | tests/test_node_set/test_lib/test_software.py | test__init__ | TestSoftware | 69 | null |
lightning-power-users/node-launcher | import os
import pytest
from node_launcher.gui.assets.asset_access import AssetAccess
def asset_access() -> AssetAccess:
asset_access = AssetAccess()
return asset_access
class TestAssetAccess(object):
def test_assets_directory(self, asset_access: AssetAccess):
test_file_path = os.path.realpath(_... | assets_directory | assert | variable | tests/test_gui/test_assets/test_asset_access.py | test_assets_directory | TestAssetAccess | 23 | null |
lightning-power-users/node-launcher | from tempfile import NamedTemporaryFile
import pytest
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import ConfigurationProperty
def configuration():
with NamedTemporaryFile(suffix='.conf', delete=True) as f:
name = f.name
co... | [ ConfigurationProperty('_new_2', 'a', 1), ConfigurationProperty('_new_3', 'b', False) ] | assert | collection | tests/test_node_set/test_lib/test_configuration.py | test_remove_configuration_by_identifier | TestConfiguration | 94 | null |
lightning-power-users/node-launcher | import os
from tempfile import mkdtemp
import pytest
from node_launcher.node_set.lnd.lnd_configuration import LndConfiguration
from node_launcher.port_utilities import is_port_in_use
def lnd_configuration() -> LndConfiguration:
tmpdirname = mkdtemp()
os.rmdir(tmpdirname)
configuration_path = os.path.join... | False | assert | bool_literal | tests/test_node_set/test_lnd/test_lnd_configuration.py | test_bitcoin_file_changed | TestDirectoryConfiguration | 58 | null |
lightning-power-users/node-launcher | from tempfile import NamedTemporaryFile
import pytest
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import ConfigurationProperty
def configuration():
with NamedTemporaryFile(suffix='.conf', delete=True) as f:
name = f.name
co... | None | assert | none_literal | tests/test_node_set/test_lib/test_configuration.py | test_delitem | TestConfiguration | 48 | null |
lightning-power-users/node-launcher | import pytest
from node_launcher.system_keyring import SystemKeyring
def system_keyring():
ring = SystemKeyring()
return ring
class TestSystemKeyring(object):
def test_get_password(self, system_keyring: SystemKeyring):
system_keyring.set_password('node_launcher_testing',
... | 'node_launcher_test_password' | assert | string_literal | tests/test_system_keyring.py | test_get_password | TestSystemKeyring | 24 | null |
lightning-power-users/node-launcher | from unittest.mock import MagicMock
from tempfile import NamedTemporaryFile
import pytest
from node_launcher.gui.menu.nodes_manage.manage_dialogs.configuration import ConfigurationDialog
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import Co... | 'key2' | assert | string_literal | tests/test_gui/test_menu/test_node_manager/test_configuration_dialog.py | test_update_key | TestConfigurationDialog | 54 | null |
lightning-power-users/node-launcher | from unittest.mock import MagicMock
from tempfile import NamedTemporaryFile
import pytest
from node_launcher.gui.menu.nodes_manage.manage_dialogs.configuration import ConfigurationDialog
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import Co... | '1' | assert | string_literal | tests/test_gui/test_menu/test_node_manager/test_configuration_dialog.py | test_append_key_value | TestConfigurationDialog | 35 | null |
lightning-power-users/node-launcher | from tempfile import NamedTemporaryFile
import pytest
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import ConfigurationProperty
def configuration():
with NamedTemporaryFile(suffix='.conf', delete=True) as f:
name = f.name
co... | configuration | assert | variable | tests/test_node_set/test_lib/test_configuration.py | test_contains | TestConfiguration | 52 | null |
lightning-power-users/node-launcher | import os
import shutil
from shutil import make_archive
import pytest
from node_launcher.constants import IS_WINDOWS
from node_launcher.node_set.lib.constants import (
DEFAULT_COMPRESSED_SUFFIX,
DEFAULT_WINDOWS_COMPRESSED_SUFFIX
)
from node_launcher.node_set.lib.node_status import SoftwareStatus
from node_lau... | 1 | assert | numeric_literal | tests/test_node_set/test_lib/test_software.py | check_file_creation | TestSoftware | 101 | null |
lightning-power-users/node-launcher | from tempfile import NamedTemporaryFile
import pytest
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import ConfigurationProperty
def configuration():
with NamedTemporaryFile(suffix='.conf', delete=True) as f:
name = f.name
co... | text | assert | variable | tests/test_node_set/test_lib/test_configuration.py | test_file_save | TestConfiguration | 26 | null |
lightning-power-users/node-launcher | import os
from tempfile import TemporaryDirectory
import pytest
from node_launcher.constants import TARGET_LND_RELEASE
from node_launcher.node_set.lnd.lnd_software import LndSoftware
def lnd_software():
lnd_software = LndSoftware()
return lnd_software
class TestLndSoftware(object):
def test_release_ver... | TARGET_LND_RELEASE | assert | variable | tests/test_node_set/test_lnd/test_lnd_software.py | test_release_version | TestLndSoftware | 26 | null |
lightning-power-users/node-launcher | import os
import shutil
import pytest
from node_launcher.constants import TARGET_BITCOIN_RELEASE, IS_MACOS, IS_WINDOWS
from node_launcher.node_set.lib.node_status import SoftwareStatus
from node_launcher.node_set.bitcoind.bitcoind_software import BitcoindSoftware
def bitcoind_software():
bitcoind_software = Bitc... | 'https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz' | assert | string_literal | tests/test_node_set/test_bitcoind/test_bitcoind_software.py | test_download_url | TestBitcoindSoftware | 79 | null |
lightning-power-users/node-launcher | import os
from tempfile import mkdtemp
import pytest
from node_launcher.node_set.bitcoind.bitcoind_configuration import \
BitcoindConfiguration
from node_launcher.node_set.lib.configuration import Configuration
def bitcoind_configuration() -> BitcoindConfiguration:
tmpdirname = mkdtemp()
os.rmdir(tmpdirn... | 'test_user' | assert | string_literal | tests/test_node_set/test_bitcoind/test_bitcoind_configuration.py | test_set_rpcuser | TestBitcoinConfiguration | 48 | null |
lightning-power-users/node-launcher | import os
from tempfile import mkdtemp
import pytest
from node_launcher.node_set.bitcoind.bitcoind_configuration import \
BitcoindConfiguration
from node_launcher.node_set.lib.configuration import Configuration
def bitcoind_configuration() -> BitcoindConfiguration:
tmpdirname = mkdtemp()
os.rmdir(tmpdirn... | new_config['port'] | assert | complex_expr | tests/test_node_set/test_bitcoind/test_bitcoind_configuration.py | test_file_changed | TestBitcoinConfiguration | 76 | null |
lightning-power-users/node-launcher | from unittest.mock import MagicMock
from tempfile import NamedTemporaryFile
import pytest
from node_launcher.gui.menu.nodes_manage.manage_dialogs.configuration import ConfigurationDialog
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import Co... | 'test_new_value' | assert | string_literal | tests/test_gui/test_menu/test_node_manager/test_configuration_dialog.py | test_append_key_value | TestConfigurationDialog | 37 | null |
lightning-power-users/node-launcher | import os
from tempfile import mkdtemp
import pytest
from node_launcher.node_set.lnd.lnd_configuration import LndConfiguration
from node_launcher.port_utilities import is_port_in_use
def lnd_configuration() -> LndConfiguration:
tmpdirname = mkdtemp()
os.rmdir(tmpdirname)
configuration_path = os.path.join... | 2 | assert | numeric_literal | tests/test_node_set/test_lnd/test_lnd_configuration.py | test_multi_property | TestDirectoryConfiguration | 31 | null |
lightning-power-users/node-launcher | from unittest.mock import MagicMock
from tempfile import NamedTemporaryFile
import pytest
from node_launcher.gui.menu.nodes_manage.manage_dialogs.configuration import ConfigurationDialog
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import Co... | 2 | assert | numeric_literal | tests/test_gui/test_menu/test_node_manager/test_configuration_dialog.py | test_update_key | TestConfigurationDialog | 47 | null |
lightning-power-users/node-launcher | from unittest.mock import MagicMock
from tempfile import NamedTemporaryFile
import pytest
from node_launcher.gui.menu.nodes_manage.manage_dialogs.configuration import ConfigurationDialog
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import Co... | sorted([ 'test_edit_value', 'test_edit_multi_value' ]) | assert | func_call | tests/test_gui/test_menu/test_node_manager/test_configuration_dialog.py | test_handle_cell_change | TestConfigurationDialog | 77 | null |
lightning-power-users/node-launcher | import os
from tempfile import mkdtemp
import pytest
from node_launcher.node_set.bitcoind.bitcoind_configuration import \
BitcoindConfiguration
from node_launcher.node_set.lib.configuration import Configuration
def bitcoind_configuration() -> BitcoindConfiguration:
tmpdirname = mkdtemp()
os.rmdir(tmpdirn... | txindex | assert | variable | tests/test_node_set/test_bitcoind/test_bitcoind_configuration.py | test_autoconfigure_datadir | TestBitcoinConfiguration | 60 | null |
lightning-power-users/node-launcher | import os
from tempfile import mkdtemp
import pytest
from node_launcher.node_set.bitcoind.bitcoind_configuration import \
BitcoindConfiguration
from node_launcher.node_set.lib.configuration import Configuration
def bitcoind_configuration() -> BitcoindConfiguration:
tmpdirname = mkdtemp()
os.rmdir(tmpdirn... | False | assert | bool_literal | tests/test_node_set/test_bitcoind/test_bitcoind_configuration.py | test_file_changed | TestBitcoinConfiguration | 69 | null |
lightning-power-users/node-launcher | import os
from tempfile import mkdtemp
import pytest
from node_launcher.node_set.lnd.lnd_configuration import LndConfiguration
from node_launcher.port_utilities import is_port_in_use
def lnd_configuration() -> LndConfiguration:
tmpdirname = mkdtemp()
os.rmdir(tmpdirname)
configuration_path = os.path.join... | new_config['listen'].split(':')[-1] | assert | func_call | tests/test_node_set/test_lnd/test_lnd_configuration.py | test_file_changed | TestDirectoryConfiguration | 78 | null |
lightning-power-users/node-launcher | from tempfile import NamedTemporaryFile
import pytest
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.lib.configuration_property import ConfigurationProperty
def configuration():
with NamedTemporaryFile(suffix='.conf', delete=True) as f:
name = f.name
co... | ConfigurationProperty('_new_3', 'b', False) | assert | func_call | tests/test_node_set/test_lib/test_configuration.py | test_get_configuration_by_identifier | TestConfiguration | 79 | null |
d0c-s4vage/lookatme | from typing import Optional
import yaml
from click.testing import CliRunner
import lookatme
import lookatme.schemas
import lookatme.themes.dark as dark_theme
import lookatme.themes.light as light_theme
import lookatme.tui
from lookatme.__main__ import main
def run_cmd(*args):
"""Run the provided arguments
""... | dark_theme_styles["style"] | assert | complex_expr | tests/test_cli.py | test_style_override_precedence_dark | 85 | null | |
d0c-s4vage/lookatme | import datetime
from lookatme.parser import Parser
def test_parse_metadata_empty():
"""Test that metadata can be correctly parsed out of a markdown
presentation
"""
input_data = """
---
---
remaining
"""
parser = Parser()
input_data, meta = parser.parse_meta(input_data)
assert input_d... | "" | assert | string_literal | tests/test_parse.py | test_parse_metadata_empty | 50 | null | |
d0c-s4vage/lookatme | import datetime
from lookatme.parser import Parser
def test_parse_slides():
"""Test that slide parsing works correctly
"""
input_data = r"""
# Slide 1
* list
* item
* item
* item
Hello there this is a paragraph
```python
code block
```
---
# Slide 2
More text
"""
parser = Parser()
... | 2 | assert | numeric_literal | tests/test_parse.py | test_parse_slides | 80 | null | |
d0c-s4vage/lookatme | from typing import Optional
import yaml
from click.testing import CliRunner
import lookatme
import lookatme.schemas
import lookatme.themes.dark as dark_theme
import lookatme.themes.light as light_theme
import lookatme.tui
from lookatme.__main__ import main
def run_cmd(*args):
"""Run the provided arguments
""... | "emacs" | assert | string_literal | tests/test_cli.py | test_style_override_precedence_dark | 87 | null | |
d0c-s4vage/lookatme | import inspect
import lookatme.tutorial as tutorial
def test_tutorial_basic(mocker):
"""Test that tutorials work correctly
"""
mocker.patch("lookatme.tutorial.GROUPED_TUTORIALS", {})
mocker.patch("lookatme.tutorial.NAMED_TUTORIALS", {})
@tutorial.tutor("category", "name", "contents")
def some... | name_md | assert | variable | tests/test_tutorial.py | test_tutorial_basic | 35 | null | |
d0c-s4vage/lookatme | import datetime
from lookatme.parser import Parser
def test_parse_metadata_empty():
"""Test that metadata can be correctly parsed out of a markdown
presentation
"""
input_data = """
---
---
remaining
"""
parser = Parser()
input_data, meta = parser.parse_meta(input_data)
assert input_d... | now.strftime("%Y-%m-%d") | assert | func_call | tests/test_parse.py | test_parse_metadata_empty | 51 | null | |
d0c-s4vage/lookatme | from typing import Optional
import yaml
from click.testing import CliRunner
import lookatme
import lookatme.schemas
import lookatme.themes.dark as dark_theme
import lookatme.themes.light as light_theme
import lookatme.tui
from lookatme.__main__ import main
def run_cmd(*args):
"""Run the provided arguments
""... | default["styles"]["style"] | assert | complex_expr | tests/test_cli.py | test_style_override_precedence_dark | 82 | null | |
d0c-s4vage/lookatme | import inspect
import lookatme.tutorial as tutorial
def test_tutorial_basic(mocker):
"""Test that tutorials work correctly
"""
mocker.patch("lookatme.tutorial.GROUPED_TUTORIALS", {})
mocker.patch("lookatme.tutorial.NAMED_TUTORIALS", {})
@tutorial.tutor("category", "name", "contents")
def some... | None | assert | none_literal | tests/test_tutorial.py | test_tutorial_basic | 30 | null | |
d0c-s4vage/lookatme | import pytest
import lookatme.widgets.table
import tests.utils as utils
TEST_STYLE = {
"style": "monokai",
"table": {
"column_spacing": 3,
"header_divider": "&",
},
}
def table_setup(tmpdir, mocker):
utils.setup_lookatme(tmpdir, mocker, style=TEST_STYLE)
def test_basic_render(tmpdir,... | 4 | assert | numeric_literal | tests/test_table.py | test_basic_render | 44 | null | |
d0c-s4vage/lookatme | import pytest
import lookatme.widgets.table
import tests.utils as utils
TEST_STYLE = {
"style": "monokai",
"table": {
"column_spacing": 3,
"header_divider": "&",
},
}
def table_setup(tmpdir, mocker):
utils.setup_lookatme(tmpdir, mocker, style=TEST_STYLE)
def test_ignored_extra_column... | 5 | assert | numeric_literal | tests/test_table.py | test_ignored_extra_column | 137 | null | |
d0c-s4vage/lookatme | from typing import Optional
import yaml
from click.testing import CliRunner
import lookatme
import lookatme.schemas
import lookatme.themes.dark as dark_theme
import lookatme.themes.light as light_theme
import lookatme.tui
from lookatme.__main__ import main
def run_cmd(*args):
"""Run the provided arguments
""... | "zenburn" | assert | string_literal | tests/test_cli.py | test_style_override_precedence_dark | 88 | null | |
d0c-s4vage/lookatme | import datetime
from lookatme.parser import Parser
def test_parse_slides_with_progressive_stops_and_hrule_splits():
"""Test that slide parsing works correctly
"""
input_data = r"""
# Heading
<!-- stop -->
p1
<!-- stop -->
p2
---
# Slide 2
More text
"""
parser = Parser()
_, slides = pars... | 4 | assert | numeric_literal | tests/test_parse.py | test_parse_slides_with_progressive_stops_and_hrule_splits | 105 | null | |
d0c-s4vage/lookatme | import datetime
from lookatme.parser import Parser
def test_parse_metadata():
"""Test that metadata can be correctly parsed out of a markdown
presentation
"""
title = "Presentation Title"
date = "September 2, 2022"
author = "The Author"
input_data = f"""
---
title: {title}
date: {date}
au... | "remaining" | assert | string_literal | tests/test_parse.py | test_parse_metadata | 30 | null | |
d0c-s4vage/lookatme | import pytest
import lookatme.widgets.table
import tests.utils as utils
TEST_STYLE = {
"style": "monokai",
"table": {
"column_spacing": 3,
"header_divider": "&",
},
}
def table_setup(tmpdir, mocker):
utils.setup_lookatme(tmpdir, mocker, style=TEST_STYLE)
def test_ignored_extra_column... | utils.row_text(content[-2]) | assert | func_call | tests/test_table.py | test_ignored_extra_column | 138 | null | |
d0c-s4vage/lookatme | import inspect
import lookatme.tutorial as tutorial
def test_tutor(mocker):
mocker.patch("lookatme.config.STYLE", {"test": {"test": "hello"}})
tutor = tutorial.Tutor(
"name",
"group",
"\n".join([
"<TUTOR:EXAMPLE>contents</TUTOR:EXAMPLE>",
"<TUTOR:STYLE>test</TUT... | md_text | assert | variable | tests/test_tutorial.py | test_tutor | 56 | null | |
d0c-s4vage/lookatme | import datetime
import marshmallow.exceptions
import pytest
from marshmallow import Schema, fields
import lookatme.schemas as schemas
def test_meta_schema_strict_style_validation():
"""Test that the style schema is STRICTLY validated. Not having this will
make it hard to debug why mistakes in style names are... | {"styles": {"invalid": ["Unknown field."]}} | assert | collection | tests/test_schemas.py | test_meta_schema_strict_style_validation | 79 | null | |
d0c-s4vage/lookatme | import inspect
import lookatme.tutorial as tutorial
def test_tutorial_basic(mocker):
"""Test that tutorials work correctly
"""
mocker.patch("lookatme.tutorial.GROUPED_TUTORIALS", {})
mocker.patch("lookatme.tutorial.NAMED_TUTORIALS", {})
@tutorial.tutor("category", "name", "contents")
def some... | category_md | assert | variable | tests/test_tutorial.py | test_tutorial_basic | 36 | null | |
d0c-s4vage/lookatme | from typing import Optional
import yaml
from click.testing import CliRunner
import lookatme
import lookatme.schemas
import lookatme.themes.dark as dark_theme
import lookatme.themes.light as light_theme
import lookatme.tui
from lookatme.__main__ import main
def run_cmd(*args):
"""Run the provided arguments
""... | 0 | assert | numeric_literal | tests/test_cli.py | test_dump_styles_unicode | 30 | null | |
d0c-s4vage/lookatme | import datetime
import marshmallow.exceptions
import pytest
from marshmallow import Schema, fields
import lookatme.schemas as schemas
def test_meta_schema():
"""Test the meta schema
"""
title = "TITLE"
author = "AUTHOR"
date = "2019-01-01"
yaml_text = f"""
title: {title}
author: {author}
date... | "2019-01-01" | assert | string_literal | tests/test_schemas.py | test_meta_schema | 30 | null | |
d0c-s4vage/lookatme | import datetime
import marshmallow.exceptions
import pytest
from marshmallow import Schema, fields
import lookatme.schemas as schemas
def test_meta_schema_strict_style_validation():
"""Test that the style schema is STRICTLY validated. Not having this will
make it hard to debug why mistakes in style names are... | marshmallow.exceptions.ValidationError) | pytest.raises | complex_expr | tests/test_schemas.py | test_meta_schema_strict_style_validation | 76 | null | |
d0c-s4vage/lookatme | import datetime
import marshmallow.exceptions
import pytest
from marshmallow import Schema, fields
import lookatme.schemas as schemas
def _validate_field_recursive(path, field, gend_value):
"""Only validate the leaf nodes - we want *specific* values that have
changed!
"""
if isinstance(field, Schema)... | gend_value | assert | variable | tests/test_schemas.py | _validate_field_recursive | 102 | null | |
d0c-s4vage/lookatme | import pytest
import lookatme.widgets.table
import tests.utils as utils
TEST_STYLE = {
"style": "monokai",
"table": {
"column_spacing": 3,
"header_divider": "&",
},
}
def table_setup(tmpdir, mocker):
utils.setup_lookatme(tmpdir, mocker, style=TEST_STYLE)
def test_ignored_extra_column... | utils.row_text(content[-1]) | assert | func_call | tests/test_table.py | test_ignored_extra_column | 140 | null | |
d0c-s4vage/lookatme | import pytest
import lookatme.widgets.table
import tests.utils as utils
TEST_STYLE = {
"style": "monokai",
"table": {
"column_spacing": 3,
"header_divider": "&",
},
}
def table_setup(tmpdir, mocker):
utils.setup_lookatme(tmpdir, mocker, style=TEST_STYLE)
def test_basic_render(tmpdir,... | None | assert | none_literal | tests/test_table.py | test_basic_render | 60 | null | |
d0c-s4vage/lookatme | import datetime
from lookatme.parser import Parser
def test_parse_smart_slides_one_h1():
"""Test that slide smart splitting works correctly
"""
input_data = r"""
# Heading Title
## Heading 2
some text
## Heading 3
more text
## Heading 4
### Sub heading
#### Sub Heading
"""
parser = Parser()... | "Heading Title" | assert | string_literal | tests/test_parse.py | test_parse_smart_slides_one_h1 | 132 | null | |
d0c-s4vage/lookatme | from tests.utils import (assert_render, render_markdown, row_text,
setup_lookatme)
def test_inline(tmpdir, mocker):
"""Test inline markdown
"""
setup_lookatme(tmpdir, mocker, style={
"style": "monokai",
"link": {
"fg": "underline",
"bg": "def... | b"emphasis" | assert | string_literal | tests/test_markdown.py | test_inline | 320 | null | |
d0c-s4vage/lookatme | from typing import Optional
import yaml
from click.testing import CliRunner
import lookatme
import lookatme.schemas
import lookatme.themes.dark as dark_theme
import lookatme.themes.light as light_theme
import lookatme.tui
from lookatme.__main__ import main
def run_cmd(*args):
"""Run the provided arguments
""... | light_theme_styles["style"] | assert | complex_expr | tests/test_cli.py | test_style_override_precedence_light | 112 | null | |
d0c-s4vage/lookatme | from tests.utils import (assert_render, render_markdown, row_text,
setup_lookatme)
def test_headings(tmpdir, mocker):
"""Test basic header rendering
"""
setup_lookatme(tmpdir, mocker, style={
"headings": {
"default": {
"fg": "bold",
... | rendered) | assert_* | variable | tests/test_markdown.py | test_headings | 40 | null | |
d0c-s4vage/lookatme | import urwid
import lookatme.config
import lookatme.tui
from lookatme.parser import Parser
def setup_lookatme(tmpdir, mocker, style=None):
mocker.patch.object(lookatme.config, "LOG")
mocker.patch("lookatme.config.SLIDE_SOURCE_DIR", new=str(tmpdir))
if style is not None:
mocker.patch("lookatme.con... | stripped | assert | variable | tests/utils.py | assert_render | 30 | null | |
d0c-s4vage/lookatme | import pytest
import lookatme.config
import lookatme.contrib.file_loader
import lookatme.render.pygments
from tests.utils import assert_render, render_markdown
TEST_STYLE = {
"style": "monokai",
"headings": {
"default": {
"fg": "bold",
"bg": "",
"prefix": "|",
... | rendered) | assert_* | variable | tests/test_file_loader.py | test_file_loader | 56 | null | |
d0c-s4vage/lookatme | import inspect
import lookatme.tutorial as tutorial
def test_real_tutorials_exist():
assert "general" in | tutorial.GROUPED_TUTORIALS | assert | complex_expr | tests/test_tutorial.py | test_real_tutorials_exist | 12 | null | |
d0c-s4vage/lookatme | import datetime
import marshmallow.exceptions
import pytest
from marshmallow import Schema, fields
import lookatme.schemas as schemas
def test_meta_schema_allowed_extra_top_level():
"""Test that extra top-level fields are allowed in the metadata. A separate
test will test that the style metadata is strictly ... | ["t1", "t2", "t3"] | assert | collection | tests/test_schemas.py | test_meta_schema_allowed_extra_top_level | 54 | null | |
d0c-s4vage/lookatme | import datetime
from lookatme.parser import Parser
def test_parse_metadata():
"""Test that metadata can be correctly parsed out of a markdown
presentation
"""
title = "Presentation Title"
date = "September 2, 2022"
author = "The Author"
input_data = f"""
---
title: {title}
date: {date}
au... | author | assert | variable | tests/test_parse.py | test_parse_metadata | 33 | null | |
d0c-s4vage/lookatme | import urwid
import lookatme.config
import lookatme.tui
from lookatme.parser import Parser
def setup_lookatme(tmpdir, mocker, style=None):
mocker.patch.object(lookatme.config, "LOG")
mocker.patch("lookatme.config.SLIDE_SOURCE_DIR", new=str(tmpdir))
if style is not None:
mocker.patch("lookatme.con... | b"" | assert | string_literal | tests/utils.py | assert_render | 28 | null | |
d0c-s4vage/lookatme | import pytest
import lookatme.widgets.table
import tests.utils as utils
TEST_STYLE = {
"style": "monokai",
"table": {
"column_spacing": 3,
"header_divider": "&",
},
}
def table_setup(tmpdir, mocker):
utils.setup_lookatme(tmpdir, mocker, style=TEST_STYLE)
def test_table_no_headers(moc... | 2 | assert | numeric_literal | tests/test_table.py | test_table_no_headers | 118 | null | |
d0c-s4vage/lookatme | import datetime
import marshmallow.exceptions
import pytest
from marshmallow import Schema, fields
import lookatme.schemas as schemas
def _validate_field_recursive(path, field, gend_value):
"""Only validate the leaf nodes - we want *specific* values that have
changed!
"""
if isinstance(field, Schema)... | str( excinfo) | assert | func_call | tests/test_schemas.py | test_sanity_check_that_errors_are_detected | 124 | null | |
tmbo/questionary | import prompt_toolkit
import pytest
from prompt_toolkit.completion import Completer
from prompt_toolkit.completion import Completion
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def path_completion_tree(tmp_path):
needed_directories = [
tmp_path / "foo",
tmp_path /... | str(path_completion_tree / "foo" / "buz") | assert | func_call | tests/prompts/test_path.py | test_complete_path_directories_only | 83 | null | |
tmbo/questionary | from tests.utils import feed_cli_with_input
def test_press_any_key_to_continue_default_message():
message = None
text = "c"
result, cli = feed_cli_with_input("press_any_key_to_continue", message, text)
assert result is | None | assert | none_literal | tests/prompts/test_press_any_key_to_continue.py | test_press_any_key_to_continue_default_message | 11 | null | |
tmbo/questionary | import re
from prompt_toolkit.validation import ValidationError
from prompt_toolkit.validation import Validator
from tests.utils import feed_cli_with_input
def test_legacy_name():
message = "What is your name"
text = "bob\r"
result, cli = feed_cli_with_input("input", message, text)
assert result ==... | "bob" | assert | string_literal | tests/prompts/test_text.py | test_legacy_name | 15 | null | |
tmbo/questionary | from copy import copy
import pytest
from questionary import Choice
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
from tests.utils import patched_prompt
def test_select_filter_handle_backspace():
message = "Foo message"
kwargs = {"choices": ["a... | "jkl" | assert | string_literal | tests/prompts/test_select.py | test_select_filter_handle_backspace | 471 | null | |
tmbo/questionary | from questionary import utils
def test_missing_arguments():
def f(a, b=2, c=None, *args, **kwargs):
pass
assert utils.missing_arguments(f, {}) == {"a"}
assert utils.missing_arguments(f, {"a": 1}) == | set() | assert | func_call | tests/test_utils.py | test_missing_arguments | 88 | null | |
tmbo/questionary | from questionary import utils
def test_default_values_of_no_args():
def f():
pass
defaults = utils.default_values_of(f)
assert defaults == | [] | assert | collection | tests/test_utils.py | test_default_values_of_no_args | 17 | null | |
tmbo/questionary | import pytest
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def test_ignore_case_autocomplete():
message = ("Pick your poison",)
kwargs = {
"choices": ["python3", "python2"],
}
texts = ["P", KeyInputs.TAB + KeyInputs.TAB + KeyInputs.ENTER + "\r"]
result, cli... | "P" | assert | string_literal | tests/prompts/test_autocomplete.py | test_ignore_case_autocomplete | 76 | null | |
tmbo/questionary | from copy import copy
import pytest
from questionary import Choice
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
from tests.utils import patched_prompt
def test_filter_prefix_multiple_letters():
message = "Foo message"
kwargs = {"choices": ["a... | "jja" | assert | string_literal | tests/prompts/test_select.py | test_filter_prefix_multiple_letters | 455 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from pytest import fail
import questionary
from questionary import form
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def example_form(inp):
return form(
q1=questionary.confirm("Hello?", input=inp, output=DummyOutput()),
... | {} | assert | collection | tests/test_form.py | run | 75 | null | |
tmbo/questionary | import pytest
from questionary import Choice
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def test_cycle_backwards():
message = "Foo message"
kwargs = {"choices": ["foo", "bar", "bazz"]}
text = KeyInputs.UP + KeyInputs.SPACE + KeyInputs.EN... | ["bazz"] | assert | collection | tests/prompts/test_checkbox.py | test_cycle_backwards | 138 | null | |
tmbo/questionary | import prompt_toolkit
import pytest
from prompt_toolkit.completion import Completer
from prompt_toolkit.completion import Completion
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def path_completion_tree(tmp_path):
needed_directories = [
tmp_path / "foo",
tmp_path /... | str(path_completion_tree / "baz" / "foo") | assert | func_call | tests/prompts/test_path.py | test_complete_requires_explicit_enter | 69 | null | |
tmbo/questionary | import asyncio
from unittest.mock import Mock
from unittest.mock import call
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.input.defaults import create_pipe_input
from prompt_toolkit.output import DummyOutput
from prompt_toolkit.styles import Attrs
from prompt_toolkit.validation import... | ValidationError) | pytest.raises | variable | tests/prompts/test_common.py | test_validator_bool_function_fails | 43 | null | |
tmbo/questionary | import uuid
import pytest
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def test_duplicated_shortcuts():
message = "Foo message"
kwargs = {
"choices": [
{"name": "foo", "key": 1},
Separator(),
{"name... | ValueError) | pytest.raises | variable | tests/prompts/test_rawselect.py | test_duplicated_shortcuts | 69 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def ask_with_patched_input(q, text):
def run(inp):
inp.send_text(text)
return q(input=inp, output=DummyOutput())
return execute_with_input_pipe(run)
def test_checkb... | {"toppings": ["foo"]} | assert | collection | tests/test_examples.py | test_checkbox_example | 76 | null | |
tmbo/questionary | import prompt_toolkit
import pytest
from prompt_toolkit.completion import Completer
from prompt_toolkit.completion import Completion
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def path_completion_tree(tmp_path):
needed_directories = [
tmp_path / "foo",
tmp_path /... | "baz" + test_path | assert | string_literal | tests/prompts/test_path.py | test_complete_custom_completer | 148 | null | |
tmbo/questionary | import re
from prompt_toolkit.validation import ValidationError
from prompt_toolkit.validation import Validator
from tests.utils import feed_cli_with_input
def test_text_validate():
message = "What is your name"
text = "Doe\r"
result, cli = feed_cli_with_input(
"text",
message,
t... | "Doe" | assert | string_literal | tests/prompts/test_text.py | test_text_validate | 36 | null | |
tmbo/questionary | import prompt_toolkit
import pytest
from prompt_toolkit.completion import Completer
from prompt_toolkit.completion import Completion
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def path_completion_tree(tmp_path):
needed_directories = [
tmp_path / "foo",
tmp_path /... | "myfile.py" | assert | string_literal | tests/prompts/test_path.py | test_path | 34 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def ask_with_patched_input(q, text):
def run(inp):
inp.send_text(text)
return q(input=inp, output=DummyOutput())
return execute_with_input_pipe(run)
def test_text_e... | {"phone": "1234567890"} | assert | collection | tests/test_examples.py | test_text_example | 37 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def ask_with_patched_input(q, text):
def run(inp):
inp.send_text(text)
return q(input=inp, output=DummyOutput())
return execute_with_input_pipe(run)
def test_depend... | { "key": "key2", "value": "k2v2", } | assert | collection | tests/test_examples.py | test_dependent_selects_example | 138 | null | |
tmbo/questionary | import asyncio
from unittest.mock import Mock
from unittest.mock import call
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.input.defaults import create_pipe_input
from prompt_toolkit.output import DummyOutput
from prompt_toolkit.styles import Attrs
from prompt_toolkit.validation import... | None | assert | none_literal | tests/prompts/test_common.py | test_validator_bool_function | 35 | null | |
tmbo/questionary | from questionary import utils
def test_missing_arguments():
def f(a, b=2, c=None, *args, **kwargs):
pass
assert utils.missing_arguments(f, {}) == | {"a"} | assert | collection | tests/test_utils.py | test_missing_arguments | 87 | null | |
tmbo/questionary | import pytest
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def test_autocomplete():
message = "Pick your poison "
text = "python3\r"
kwargs = {
"choices": ["python3", "python2"],
}
result, cli = feed_cli_with_input("autocomplete", message, text, **kwargs)
... | "python3" | assert | string_literal | tests/prompts/test_autocomplete.py | test_autocomplete | 16 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def ask_with_patched_input(q, text):
def run(inp):
inp.send_text(text)
return q(input=inp, output=DummyOutput())
return execute_with_input_pipe(run)
def test_passwo... | {"password": "asdf"} | assert | collection | tests/test_examples.py | test_password_example | 89 | null | |
tmbo/questionary | from copy import copy
import pytest
from questionary import Choice
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
from tests.utils import patched_prompt
def test_filter_prefix_one_letter():
message = "Foo message"
kwargs = {"choices": ["abc", "... | "ghi" | assert | string_literal | tests/prompts/test_select.py | test_filter_prefix_one_letter | 439 | null | |
tmbo/questionary | import asyncio
from unittest.mock import Mock
from unittest.mock import call
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.input.defaults import create_pipe_input
from prompt_toolkit.output import DummyOutput
from prompt_toolkit.styles import Attrs
from prompt_toolkit.validation import... | "invalid input" | assert | string_literal | tests/prompts/test_common.py | test_validator_instance_fails | 67 | null | |
tmbo/questionary | from copy import copy
import pytest
from questionary import Choice
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
from tests.utils import patched_prompt
def test_select_second_choice():
message = "Foo message"
kwargs = {"choices": ["foo", "bar"... | "bar" | assert | string_literal | tests/prompts/test_select.py | test_select_second_choice | 52 | null | |
tmbo/questionary | import asyncio
from unittest.mock import Mock
from unittest.mock import call
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.input.defaults import create_pipe_input
from prompt_toolkit.output import DummyOutput
from prompt_toolkit.styles import Attrs
from prompt_toolkit.validation import... | 4 | assert | numeric_literal | tests/prompts/test_common.py | test_print_with_style | 205 | null | |
tmbo/questionary | from questionary import utils
def test_filter_kwargs_empty():
def f():
pass
kwargs = {
"a": 1,
"b": 2,
}
filtered = utils.used_kwargs(kwargs, f)
assert filtered == | {} | assert | collection | tests/test_utils.py | test_filter_kwargs_empty | 64 | null | |
tmbo/questionary | import prompt_toolkit
import pytest
from prompt_toolkit.completion import Completer
from prompt_toolkit.completion import Completion
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def path_completion_tree(tmp_path):
needed_directories = [
tmp_path / "foo",
tmp_path /... | str(excinfo) | assert | func_call | tests/prompts/test_path.py | test_get_paths_validation | 129 | null | |
tmbo/questionary | from copy import copy
import pytest
from questionary import Choice
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
from tests.utils import patched_prompt
def test_select_filter_handle_backspace():
message = "Foo message"
kwargs = {"choices": ["a... | "abc" | assert | string_literal | tests/prompts/test_select.py | test_select_filter_handle_backspace | 494 | null | |
tmbo/questionary | import uuid
import pytest
from questionary import Separator
from tests.utils import KeyInputs
from tests.utils import feed_cli_with_input
def test_select_third_choice():
message = "Foo message"
kwargs = {"choices": ["foo", "bar", "bazz"]}
text = "2" + "3" + KeyInputs.ENTER + "\r"
result, cli = feed_... | "bazz" | assert | string_literal | tests/prompts/test_rawselect.py | test_select_third_choice | 44 | null | |
tmbo/questionary | from questionary import utils
def test_required_arguments_of():
def f(a, b=2, c=None, *args, **kwargs):
pass
defaults = utils.required_arguments(f)
assert defaults == | ["a"] | assert | collection | tests/test_utils.py | test_required_arguments_of | 72 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def ask_with_patched_input(q, text):
def run(inp):
inp.send_text(text)
return q(input=inp, output=DummyOutput())
return execute_with_input_pipe(run)
def test_confir... | result_py | assert | variable | tests/test_examples.py | test_confirm_example | 25 | null | |
tmbo/questionary | from questionary import utils
def test_arguments_of():
def f(a, b=2, c=None, *args, **kwargs):
pass
defaults = utils.arguments_of(f)
assert defaults == | ["a", "b", "c", "args", "kwargs"] | assert | collection | tests/test_utils.py | test_arguments_of | 25 | null | |
tmbo/questionary | import asyncio
from unittest.mock import Mock
from unittest.mock import call
import pytest
from prompt_toolkit.document import Document
from prompt_toolkit.input.defaults import create_pipe_input
from prompt_toolkit.output import DummyOutput
from prompt_toolkit.styles import Attrs
from prompt_toolkit.validation import... | 0 | assert | numeric_literal | tests/prompts/test_common.py | test_prompt_highlight_coexist | 118 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from pytest import fail
import questionary
from questionary import form
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def example_form(inp):
return form(
q1=questionary.confirm("Hello?", input=inp, output=DummyOutput()),
... | {"q1": True, "q2": "foo"} | assert | collection | tests/test_form.py | run | 35 | null | |
tmbo/questionary | from prompt_toolkit.output import DummyOutput
from tests.utils import KeyInputs
from tests.utils import execute_with_input_pipe
def ask_with_patched_input(q, text):
def run(inp):
inp.send_text(text)
return q(input=inp, output=DummyOutput())
return execute_with_input_pipe(run)
def test_select... | {"theme": "Make a reservation"} | assert | collection | tests/test_examples.py | test_select_example | 50 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.