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
nat-n/poethepoet
import pytest def generate_choices_pyproject(temp_pyproject): def generator(): project_tmpl = """ [tool.poe.tasks.check] cmd = "poe_test_echo ${package}" [[tool.poe.tasks.check.args]] name = "package" positional = true choices = ["all"...
1
assert
numeric_literal
tests/test_arg_choices.py
test_choices_rejects_invalid_value
94
null
nat-n/poethepoet
import shutil import pytest def test_shell_task(run_poe_subproc): result = run_poe_subproc("count", project="shells") assert result.capture == ( "Poe => poe_test_echo 1 && poe_test_echo 2 " "&& poe_test_echo $(python -c 'print(1 + 2)')\n" ) assert result.stdout == "1\n2\n3\n" asse...
""
assert
string_literal
tests/test_shell_task.py
test_shell_task
13
null
nat-n/poethepoet
import sys def test_switch_capture_out(run_poe_subproc, projects): result = run_poe_subproc("capture_out", project="switch") assert result.capture == ("Poe <= 43\nPoe <= echo default\n") assert result.stdout == "" assert result.stderr == "" output_path = projects["switch"].joinpath("out.txt") ...
"default\n"
assert
string_literal
tests/test_switch_task.py
test_switch_capture_out
134
null
nat-n/poethepoet
import shutil import subprocess import pytest def _bash_is_available() -> bool: """Check if bash is actually available and functional.""" bash_path = shutil.which("bash") if bash_path is None: return False try: proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5...
"my-task"
assert
string_literal
tests/completion/test_bash_completion_harness.py
test_task_with_dashes
TestBashEdgeCases
982
null
nat-n/poethepoet
import subprocess import tempfile from dataclasses import dataclass, field from pathlib import Path def escape_for_shell(value: str) -> str: """Escape a string for use in single-quoted shell context.""" return value.replace("'", "'\"'\"'") class BashHarnessRunner: def __init__(self, work_dir: Path | None...
None
assert
none_literal
tests/completion/bash_harness.py
run
BashHarnessRunner
501
null
nat-n/poethepoet
import re from poethepoet import __version__ poetry_vars = {"POETRY_VIRTUALENVS_CREATE": "false"} def test_version_option(run_poe): result = run_poe("--version") assert result.code ==
0
assert
numeric_literal
tests/test_cli.py
test_version_option
89
null
nat-n/poethepoet
import os from pathlib import Path from shutil import rmtree import pytest from poethepoet.scripts import rm _test_file_tree = { "pkg": { "__pycache__": {"foo.pyc": "XXX"}, "foo.py": "XXX", "bar": { "baz.py": "XXX", "__pycache__": {"baz.pyc": "XXX"}, }, ...
"Deleting file '.mypy_cache'\n" "Deleting file '.pytest_cache'\n" "Deleting paths matching './**/__pycache__'\n" "Deleting directory '__pycache__'\n" "Deleting directory 'pkg\\__pycache__'\n" "Deleting directory 'pkg\\bar\\__pycache__'\n"
assert
string_literal
tests/test_scripts.py
test_rm_dry_mode_verbose
115
null
nat-n/poethepoet
import sys def test_switch_on_platform(run_poe_subproc): common_prefix = "Poe <= override or sys.platform\n" result = run_poe_subproc("platform_dependent", project="switch") if sys.platform == "win32": assert ( result.capture == f"{common_prefix}Poe => import sys; print('Yo...
""
assert
string_literal
tests/test_switch_task.py
test_switch_on_platform
33
null
nat-n/poethepoet
import shutil import subprocess import pytest from poethepoet import _escape_choice, _format_help class TestZshEdgeCases: def test_positional_args_output(self, run_poe_main, projects): """Positional args should have type 'positional'.""" scripts_path = str(projects["scripts"]) result = r...
1
assert
numeric_literal
tests/completion/test_zsh_completion.py
test_positional_args_output
TestZshEdgeCases
384
null
nat-n/poethepoet
def test_customize_program_name(run_poe, projects): result = run_poe(program_name="boop") assert "Usage:\n boop [global options] task" in result.capture assert result.stdout ==
""
assert
string_literal
tests/test_api.py
test_customize_program_name
4
null
nat-n/poethepoet
import shutil import subprocess import pytest class TestZshCompletionE2E: def completion_script(self, run_poe_main): """Get the generated zsh completion script.""" result = run_poe_main("_zsh_completion") return result.stdout def test_global_options_still_work_before_task( se...
""
assert
string_literal
tests/completion/test_zsh_completion_harness.py
test_global_options_still_work_before_task
TestZshCompletionE2E
467
null
nat-n/poethepoet
from io import StringIO import pytest from poethepoet.helpers.command import parse_poe_cmd from poethepoet.helpers.command.ast import Glob, PythonGlob, Script from poethepoet.helpers.command.ast_core import ParseConfig, ParseCursor, ParseError def test_parse_comments(): tree = parse_poe_cmd( """# 1 ...
4
assert
numeric_literal
tests/helpers/command/test_ast.py
test_parse_comments
20
null
nat-n/poethepoet
import re from poethepoet import __version__ poetry_vars = {"POETRY_VIRTUALENVS_CREATE": "false"} def test_call_no_args(run_poe): result = run_poe() assert result.capture.startswith( f"Poe the Poet (version {__version__})" ), "Output should start with poe header line" assert (
result.capture
assert
complex_expr
tests/test_cli.py
test_call_no_args
16
null
nat-n/poethepoet
import pytest def generate_pyproject(temp_pyproject): def generator(project_verbosity=0, task_verbosity=0): def inline_task(inline_verbosity: int) -> str: return ( '{ cmd = "poe_test_echo inline_task ' + str(inline_verbosity) + ' ${POE_VERBOSITY}"...
"task verbosity up\n"
assert
string_literal
tests/test_verbosity.py
test_switch_task_with_verbosity
192
null
nat-n/poethepoet
import shutil import subprocess import pytest class TestZshCompletionE2E: def completion_script(self, run_poe_main): """Get the generated zsh completion script.""" result = run_poe_main("_zsh_completion") return result.stdout def test_value_option_specs_include_equals(self, zsh_harne...
2
assert
numeric_literal
tests/completion/test_zsh_completion_harness.py
test_value_option_specs_include_equals
TestZshCompletionE2E
351
null
nat-n/poethepoet
import shutil import subprocess import pytest def _bash_is_available() -> bool: """Check if bash is actually available and functional.""" bash_path = shutil.which("bash") if bash_path is None: return False try: proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5...
"my_task"
assert
string_literal
tests/completion/test_bash_completion_harness.py
test_task_with_underscores
TestBashEdgeCases
1,000
null
nat-n/poethepoet
import shutil import subprocess import pytest def _bash_is_available() -> bool: """Check if bash is actually available and functional.""" bash_path = shutil.which("bash") if bash_path is None: return False try: proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5...
"mytask"
assert
string_literal
tests/completion/test_bash_completion_harness.py
test_task_e_value_not_skipped_by_global_parsing
TestBashTaskOptionIsolation
1,543
null
nat-n/poethepoet
import pytest def generate_pyproject(temp_pyproject): def generator(project_verbosity=0, task_verbosity=0): def inline_task(inline_verbosity: int) -> str: return ( '{ cmd = "poe_test_echo inline_task ' + str(inline_verbosity) + ' ${POE_VERBOSITY}"...
"cmd task with verbosity 2 0\n"
assert
string_literal
tests/test_verbosity.py
test_override_verbosity_with_cli
134
null
nat-n/poethepoet
def test_expr_with_args(run_poe_subproc): result = run_poe_subproc("expr_with_args", project="expr") assert result.capture == ( """Poe => "power level is " + (f"only {power_level}" """ """if int(${power_level}) <= 9000 else 'over nine thousand!\')\n""" ) assert result.stdout == "power le...
""
assert
string_literal
tests/test_expr_task.py
test_expr_with_args
8
null
nat-n/poethepoet
import shutil import subprocess import pytest def _bash_is_available() -> bool: """Check if bash is actually available and functional.""" bash_path = shutil.which("bash") if bash_path is None: return False try: proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5...
0
assert
numeric_literal
tests/completion/test_bash_completion.py
test_describe_task_args_output_format
TestTaskArgsOutputFormat
217
null
nat-n/poethepoet
import pytest def generate_choices_pyproject(temp_pyproject): def generator(): project_tmpl = """ [tool.poe.tasks.check] cmd = "poe_test_echo ${package}" [[tool.poe.tasks.check.args]] name = "package" positional = true choices = ["all"...
""
assert
string_literal
tests/test_arg_choices.py
test_choices_are_listed_in_help
47
null
nat-n/poethepoet
from typing import Annotated, Any, TypedDict import pytest from poethepoet.exceptions import ConfigValidationError from poethepoet.options import PoeOptions from poethepoet.options.annotations import Metadata def test_with_field_accepts_any_and_preserves_value(): """If a field is annotated as Any, parse preserve...
2.71)
pytest.approx
numeric_literal
tests/options/test_options.py
test_with_field_accepts_any_and_preserves_value
52
null
nat-n/poethepoet
import pytest def test_sequence_task(run_poe_subproc, esc_prefix): result = run_poe_subproc("composite_task", project="sequences") asse
"Poe => poe_test_echo Hello\n" "Poe => poe_test_echo 'World!'\n" "Poe => poe_test_echo ':)!'\n"
assert
string_literal
tests/test_sequence_tasks.py
test_sequence_task
6
null
nat-n/poethepoet
import shutil import subprocess import pytest class TestZshCompletionE2E: def completion_script(self, run_poe_main): """Get the generated zsh completion script.""" result = run_poe_main("_zsh_completion") return result.stdout def test_value_option_specs_include_equals(self, zsh_harne...
spec
assert
variable
tests/completion/test_zsh_completion_harness.py
test_value_option_specs_include_equals
TestZshCompletionE2E
361
null
nat-n/poethepoet
import pytest def generate_pyproject(temp_pyproject): def generator(project_verbosity=0, task_verbosity=0): def inline_task(inline_verbosity: int) -> str: return ( '{ cmd = "poe_test_echo inline_task ' + str(inline_verbosity) + ' ${POE_VERBOSITY}"...
""
assert
string_literal
tests/test_verbosity.py
test_task_vs_project_verbosity
71
null
nat-n/poethepoet
import pytest def generate_pyproject(temp_pyproject): def generator(project_verbosity=0, task_verbosity=0): def inline_task(inline_verbosity: int) -> str: return ( '{ cmd = "poe_test_echo inline_task ' + str(inline_verbosity) + ' ${POE_VERBOSITY}"...
"cmd task inheriting default verbosity 0 0\n"
assert
string_literal
tests/test_verbosity.py
test_task_vs_project_verbosity
68
null
nat-n/poethepoet
EXAMPLE_CONFIG = """ [tool.poe.env] GLOBAL_POE_ROOT = "${POE_ROOT}" GLOBAL_POE_PWD = "${POE_PWD}" [tool.poe.tasks.my-task] default_item_type = "cmd" sequence = [ "echo POE_ROOT: ${POE_ROOT}", "echo GLOBAL_POE_ROOT: ${GLOBAL_POE_ROOT}", "echo TASK_POE_ROOT: ${TASK_POE_ROOT}", "echo POE_PWD: ${POE_PWD}", "echo...
"Poe => ${FILE}\n"
assert
string_literal
tests/test_env_config.py
test_substitution_in_envvar
52
null
nat-n/poethepoet
from typing import Annotated, Any, TypedDict import pytest from poethepoet.exceptions import ConfigValidationError from poethepoet.options import PoeOptions from poethepoet.options.annotations import Metadata def test_optional_field_returns_none_when_not_set(): class OptTest(PoeOptions): maybe: int | Non...
None
assert
none_literal
tests/options/test_options.py
test_optional_field_returns_none_when_not_set
99
null
nat-n/poethepoet
poetry_vars = {"POETRY_VIRTUALENVS_CREATE": "false"} def test_setting_default_array_item_task_type(run_poe_subproc): result = run_poe_subproc( "composite_task", project="scripts", env={"POETRY_VIRTUALENVS_CREATE": "false"} ) assert (
"Poe => poe_test_echo Hello\nPoe => poe_test_echo 'World!'\n"
assert
string_literal
tests/test_poe_config.py
test_setting_default_array_item_task_type
27
null
nat-n/poethepoet
from pathlib import Path import pytest def test_call_echo_task(run_poe_subproc, projects, esc_prefix, is_windows): result = run_poe_subproc("echo", "foo", "!", project="cmds") if is_windows: assert result.capture == ( "Poe => poe_test_echo " f"'POE_ROOT:{projects['cmds']}' Pass...
""
assert
string_literal
tests/test_cmd_tasks.py
test_call_echo_task
20
null
nat-n/poethepoet
import os from pathlib import Path from shutil import rmtree import pytest from poethepoet.scripts import rm _test_file_tree = { "pkg": { "__pycache__": {"foo.pyc": "XXX"}, "foo.py": "XXX", "bar": { "baz.py": "XXX", "__pycache__": {"baz.pyc": "XXX"}, }, ...
"Deleting file '.mypy_cache'\n" "Deleting file '.pytest_cache'\n" "Deleting paths matching './**/__pycache__'\n" "Deleting directory '__pycache__'\n" "Deleting directory 'pkg/__pycache__'\n" "Deleting directory 'pkg/bar/__pycache__'\n"
assert
string_literal
tests/test_scripts.py
test_rm_dry_mode_verbose
124
null
nat-n/poethepoet
import pytest def fmt_ignore_fail(value): if value is True: return "ignore_fail = true" if isinstance(value, str): return f'ignore_fail = "{value}"' if isinstance(value, list): return f"ignore_fail = {value}" return "" def generate_pyproject(temp_pyproject): def generator(l...
0
assert
numeric_literal
tests/test_ignore_fail.py
test_full_ignore
221
null
nat-n/poethepoet
from collections.abc import Sequence import pytest def generate_pyproject(temp_pyproject): def generator( delay_factor=1, seq1_ignore_fail=False, seq2_ignore_fail=False, para1_ignore_fail=False, para2_ignore_fail=False, ): def fmt_ignore_fail(value): ...
0
assert
numeric_literal
tests/test_parallel_tasks.py
test_parallel_ignore_failures
318
null
nat-n/poethepoet
from typing import Annotated, Any, TypedDict import pytest from poethepoet.exceptions import ConfigValidationError from poethepoet.options import PoeOptions from poethepoet.options.annotations import Metadata def test_poe_options_basic_parse_and_defaults(): """Basic parse: provided values are kept; defaults are ...
42
assert
numeric_literal
tests/options/test_options.py
test_poe_options_basic_parse_and_defaults
39
null
nat-n/poethepoet
import shutil import pytest @pytest.mark.skipif(not shutil.which("sh"), reason="No sh available") def test_interpreter_sh(run_poe_subproc): result = run_poe_subproc("echo_sh", project="shells") assert result.capture == ("Poe => poe_test_echo $0 $test_var\n") assert "roflcopter" in
result.stdout
assert
complex_expr
tests/test_shell_task.py
test_interpreter_sh
51
null
nat-n/poethepoet
import shutil import subprocess import pytest def _bash_is_available() -> bool: """Check if bash is actually available and functional.""" bash_path = shutil.which("bash") if bash_path is None: return False try: proc = subprocess.run(["bash", "--version"], capture_output=True, timeout=5...
"/root/path"
assert
string_literal
tests/completion/test_bash_completion_harness.py
test_task_completion_after_root_option
TestBashTaskCompletion
230
null
nat-n/poethepoet
def test_trying_to_load_nonexistent_envfiles(run_poe_subproc, projects): result = run_poe_subproc( f"-C={projects['envfile/multiple_envfiles']}", "handle_disappointment" ) assert "Poe => poe_test_echo OK\n" in result.capture assert "Warning: Poe failed to locate envfile at" in result.capture ...
"OK\n"
assert
string_literal
tests/test_envfile.py
test_trying_to_load_nonexistent_envfiles
45
null
nat-n/poethepoet
from poethepoet import __version__ def test_version(pyproject): assert (
pyproject["project"]["version"]
assert
complex_expr
tests/test_version.py
test_version
5
null
nat-n/poethepoet
import pytest def generate_pyproject(temp_pyproject): def generator(project_verbosity=0, task_verbosity=0): def inline_task(inline_verbosity: int) -> str: return ( '{ cmd = "poe_test_echo inline_task ' + str(inline_verbosity) + ' ${POE_VERBOSITY}"...
"cmd task with verbosity 2 1\n"
assert
string_literal
tests/test_verbosity.py
test_override_verbosity_with_cli
126
null
ideoforms/isobar
import pytest import isobar as iso def test_pdict(): a = iso.PDict({ "a": iso.PSequence([1, 2, 3], 1), "b": 4, "c": None }) assert list(a) == [ {"a": 1, "b": 4, "c": None}, {"a": 2, "b": 4, "c": None}, {"a": 3, "b": 4, "c": None} ] a = iso.PDict([{"a...
[{"a": 1}, {"a": 2}, {"a": 3}]
assert
collection
tests/test_pattern_core.py
test_pdict
58
null
ideoforms/isobar
import pytest import isobar as iso def test_parpeggiator(): a = iso.PArpeggiator([0, 1, 2, 3], iso.PArpeggiator.UP) assert a.nextn(16) == [0, 1, 2, 3] a = iso.PArpeggiator([0, 1, 2, 3], iso.PArpeggiator.DOWN) assert a.nextn(16) ==
[3, 2, 1, 0]
assert
collection
tests/test_pattern_sequence.py
test_parpeggiator
128
null
ideoforms/isobar
import isobar as iso import pytest import math from . import dummy_timeline def test_event_control_linear_interpolation_zero_duration(dummy_timeline): control_series = iso.PSequence([0, 1]) duration_series = iso.PSequence([1, 0]) dummy_timeline.ticks_per_beat = 10 dummy_timeline.schedule({ iso....
values, rel=0.0000001)
pytest.approx
complex_expr
tests/test_timeline_event_control.py
test_event_control_linear_interpolation_zero_duration
62
null
ideoforms/isobar
import isobar as iso import pytest from . import dummy_timeline def dummy_track(): return iso.Track(output_device=iso.io.DummyOutputDevice()) def test_track_defaults(dummy_timeline): track = dummy_timeline.schedule(name="test_track") track.add_note(iso.MidiNoteInstance(timestamp=0.0, note=60)) track....
32
assert
numeric_literal
tests/test_timeline_track.py
test_track_defaults
147
null
ideoforms/isobar
import isobar as iso import pytest import time from isobar.io import DummyOutputDevice, MidiOutputDevice from . import dummy_timeline from isobar.exceptions import InvalidEventException def test_timeline_schedule(dummy_timeline): events = { iso.EVENT_NOTE: iso.PSequence([1], 1) } dummy_timeline.sch...
2
assert
numeric_literal
tests/test_timeline.py
test_timeline_schedule
47
null
ideoforms/isobar
import pytest import isobar as iso def test_pattern_stopiteration(): p = iso.PSequence([1, 2, 3], 1) assert next(p) == 1 assert next(p) == 2 assert next(p) ==
3
assert
numeric_literal
tests/test_pattern.py
test_pattern_stopiteration
10
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_dict_permut(dummy_timeline): notes = [ {"note": 60, "duration": 0.5}, {"note": 64, "duration": 0.25}, {"note": 67, "duration": 1.0} ] dummy_timeline.schedule(iso.PPermut(iso.PSe...
[60, 60, 64, 64, 67, 67, 60, 60, 67, 67, 64, 64, 64, 64, 60, 60, 67, 67, 64, 64, 67, 67, 60, 60, 67, 67, 60, 60, 64, 64, 67, 67, 64, 64, 60, 60]
assert
collection
tests/test_timeline_event.py
test_event_dict_permut
192
null
ideoforms/isobar
from isobar import midi_note_to_note_name, note_name_to_midi_note, frequency_to_midi_note, midi_note_to_frequency import numpy as np import numpy.testing as npt def test_util_midi_note_to_note_name(): assert midi_note_to_note_name(60 - 60) == 'C-1' assert midi_note_to_note_name(60 - 48) == 'C0' assert midi...
'C2'
assert
string_literal
tests/test_util.py
test_util_midi_note_to_note_name
11
null
ideoforms/isobar
import pytest import isobar as iso from . import dummy_timeline def test_pcurrenttime(dummy_timeline): pattern = iso.PCurrentTime() assert next(pattern) ==
0
assert
numeric_literal
tests/test_pattern_static.py
test_pcurrenttime
31
null
ideoforms/isobar
from . import dummy_timeline def test_track_solo_multiple(dummy_timeline): track1 = dummy_timeline.schedule({"note": 60}) track2 = dummy_timeline.schedule({"note": 62}) track3 = dummy_timeline.schedule({"note": 64}) # Solo 1 and 2 track1.solo() track2.solo() dummy_timeline.tick() ...
[60, 62]
assert
collection
tests/test_track_solo.py
test_track_solo_multiple
50
null
ideoforms/isobar
import isobar as iso import pytest import time from isobar.io import DummyOutputDevice, MidiOutputDevice from . import dummy_timeline from isobar.exceptions import InvalidEventException def test_timeline_schedule(dummy_timeline): events = { iso.EVENT_NOTE: iso.PSequence([1], 1) } dummy_timeline.sch...
1
assert
numeric_literal
tests/test_timeline.py
test_timeline_schedule
45
null
ideoforms/isobar
import pytest import isobar as iso def test_parpeggiator(): a = iso.PArpeggiator([0, 1, 2, 3], iso.PArpeggiator.UP) assert a.nextn(16) == [0, 1, 2, 3] a = iso.PArpeggiator([0, 1, 2, 3], iso.PArpeggiator.DOWN) assert a.nextn(16) == [3, 2, 1, 0] a = iso.PArpeggiator([0, 1, 2, 3], iso.PArpeggiator.C...
[1, 2, 0, 3]
assert
collection
tests/test_pattern_sequence.py
test_parpeggiator
143
null
ideoforms/isobar
import isobar as iso import pytest from . import dummy_timeline def dummy_track(): return iso.Track(output_device=iso.io.DummyOutputDevice()) def test_track_defaults(dummy_timeline): track = dummy_timeline.schedule(name="test_track") track.add_note(iso.MidiNoteInstance(timestamp=0.0, note=60)) track....
97
assert
numeric_literal
tests/test_timeline_track.py
test_track_defaults
154
null
ideoforms/isobar
import isobar as iso import pytest import time from isobar.io import DummyOutputDevice, MidiOutputDevice from . import dummy_timeline from isobar.exceptions import InvalidEventException def test_timeline_seconds_to_beats(dummy_timeline): try: timeline = iso.Timeline(120) assert timeline.seconds_to...
2)
pytest.approx
numeric_literal
tests/test_timeline.py
test_timeline_seconds_to_beats
320
null
ideoforms/isobar
import pytest import isobar as iso def test_ppatterngeneratoraction(): n = 0 def generate(): nonlocal n n += 1 if n == 1: return iso.PSequence([0], 2) elif n == 2: return iso.PSequence([1, 2], 1) else: return None a = iso.PPatter...
0
assert
numeric_literal
tests/test_pattern_sequence.py
test_ppatterngeneratoraction
175
null
ideoforms/isobar
import pytest import isobar as iso def test_pmiditofrequency(): a = iso.PMidiNoteToFrequency(iso.PSequence([0, 60, 60.5, None], 1)) assert list(a) ==
[8.175798915643707, 261.6255653005986, 269.2917795270241, None]
assert
collection
tests/test_pattern_tonal.py
test_pmiditofrequency
22
null
ideoforms/isobar
import pytest import isobar as iso def test_parrayindex(): ar = iso.PSequence([[0, 1, 2, 3, 4], [0, 1, 4, 9, 16]]) a = iso.PSequence([0, 2, 4], 1) b = iso.PArrayIndex(ar, a) assert next(b) ==
0
assert
numeric_literal
tests/test_pattern_core.py
test_parrayindex
31
null
ideoforms/isobar
import isobar as iso def test_pattern_sub(): p1 = iso.PSequence([1, 2, 3], 1) assert list(p1 - 0.5) == [0.5, 1.5, 2.5] assert list(1 + p1) ==
[2, 3, 4]
assert
collection
tests/test_pattern_operators.py
test_pattern_sub
16
null
ideoforms/isobar
import isobar as iso import pytest def test_key_eq(): a = iso.Key() b = iso.Key(0, iso.Scale([0, 2, 4, 5, 7, 9, 11])) assert a == b c = iso.Key(0, iso.Scale([0, 2, 3, 5, 7, 9, 11])) assert a !=
c
assert
variable
tests/test_key.py
test_key_eq
16
null
ideoforms/isobar
from . import dummy_timeline def test_track_solo(dummy_timeline): track1 = dummy_timeline.schedule({"note": 60}) track2 = dummy_timeline.schedule({"note": 62}) # Neither track soloed: both should play dummy_timeline.tick() assert dummy_timeline.output_device.events == [ [0, 'note_on', ...
[ [1, 'note_off', 60, 0], [1, 'note_on', 60, 64, 0], [1, 'note_off', 62, 0] ]
assert
collection
tests/test_track_solo.py
test_track_solo
20
null
ideoforms/isobar
import isobar as iso import pytest import math from . import dummy_timeline def test_event_control_no_interpolation(dummy_timeline): """ Simple case: schedule a series of regularly-spaced control points. Output device should receive discrete control events. """ control_series = iso.PSeries(start=1,...
[ [0, "control", 0, 1, 9], [1, "control", 0, 3, 9], [2, "control", 0, 5, 9] ]
assert
collection
tests/test_timeline_event_control.py
test_event_control_no_interpolation
21
null
ideoforms/isobar
import isobar as iso def test_chord(): chord = iso.Chord([3, 4, 3]) assert chord.intervals ==
[3, 4, 3]
assert
collection
tests/test_chord.py
test_chord
9
null
ideoforms/isobar
import pytest import isobar as iso def test_pattern_iter(): p = iso.PSequence([1, 2, 3], 1) i = iter(p) o = list(i) assert o ==
[1, 2, 3]
assert
collection
tests/test_pattern.py
test_pattern_iter
25
null
ideoforms/isobar
import isobar as iso def test_pattern_pow(): p1 = iso.PSequence([1, 2, 3], 1) assert list(p1 ** 2) ==
[1, 4, 9]
assert
collection
tests/test_pattern_operators.py
test_pattern_pow
55
null
ideoforms/isobar
from isobar import midi_note_to_note_name, note_name_to_midi_note, frequency_to_midi_note, midi_note_to_frequency import numpy as np import numpy.testing as npt def test_util_frequency_to_midi_note(): npt.assert_almost_equal(frequency_to_midi_note(261.6255653005986),
60)
assert_*
numeric_literal
tests/test_util.py
test_util_frequency_to_midi_note
43
null
ideoforms/isobar
import isobar as iso import pytest def test_key_eq(): a = iso.Key() b = iso.Key(0, iso.Scale([0, 2, 4, 5, 7, 9, 11])) assert a == b c = iso.Key(0, iso.Scale([0, 2, 3, 5, 7, 9, 11])) assert a != c d = iso.Key(1, iso.Scale([0, 2, 4, 5, 7, 9, 11])) assert a !=
d
assert
variable
tests/test_key.py
test_key_eq
18
null
ideoforms/isobar
import pytest import isobar as iso def test_pscalar(): a = iso.PScalar(iso.PSequence([1, (2, 3), (4, 5, 6), (), 7], 1), method="mean") assert list(a) == [1,2.5,5,None,7] a = iso.PScalar(iso.PSequence([1, (2, 3), (4, 5, 6), (), 7], 1), method="first") assert list(a) ==
[1,2,4,None,7]
assert
collection
tests/test_pattern_scalar.py
test_pscalar
74
null
ideoforms/isobar
import pytest import isobar as iso def test_pfunc(): s = "abc" a = iso.PSequence([0, 1, 2], 1) b = iso.PFunc(lambda: s[next(a)]) assert next(b) == 'a' assert next(b) == 'b' assert next(b) ==
'c'
assert
string_literal
tests/test_pattern_core.py
test_pfunc
23
null
ideoforms/isobar
from . import dummy_timeline def test_track_mute_exclusive(dummy_timeline): """ Test exclusive mute functionality. """ track1 = dummy_timeline.schedule({"note": 60}) track2 = dummy_timeline.schedule({"note": 62}) track3 = dummy_timeline.schedule({"note": 64}) # Mute track 1 and 3 normally ...
[60, 64]
assert
collection
tests/test_track_mute.py
test_track_mute_exclusive
73
null
ideoforms/isobar
import pytest import isobar as iso def test_preverse(): a = iso.PSequence([1, 2, 3, 4, 5], 1) b = iso.PReverse(a) assert list(b) ==
[5, 4, 3, 2, 1]
assert
collection
tests/test_pattern_sequence.py
test_preverse
82
null
ideoforms/isobar
from . import dummy_timeline def test_track_mute(dummy_timeline): """ Test basic mute functionality. """ track1 = dummy_timeline.schedule({"note": 60}) track2 = dummy_timeline.schedule({"note": 62}) # Neither track muted: both should play dummy_timeline.tick() assert dummy_timeline.ou...
[ [0, 'note_on', 60, 64, 0], [0, 'note_on', 62, 64, 0] ]
assert
collection
tests/test_track_mute.py
test_track_mute
12
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_degree(dummy_timeline): dummy_timeline.schedule({ iso.EVENT_DEGREE: iso.PSequence([0, 1, 2, 3, None, 7, -1], 1), iso.EVENT_DURATION: 1.0, iso.EVENT_TRANSPOSE: 12 }) dummy_timelin...
[ [0, 'note_on', 12, 64, 0], [1, 'note_off', 12, 0], [1, 'note_on', 14, 64, 0], [2, 'note_off', 14, 0], [2, 'note_on', 16, 64, 0], [3, 'note_off', 16, 0], [3, 'note_on', 17, 64, 0], [4, 'note_off', 17, 0], [5, 'note_on', 24, 64, 0], [6, 'note_off', 24, 0], [6, 'note_on', 11, 64, 0], [7, 'note_off', 11, 0] ]
assert
collection
tests/test_timeline_event.py
test_event_degree
15
null
ideoforms/isobar
from isobar import midi_note_to_note_name, note_name_to_midi_note, frequency_to_midi_note, midi_note_to_frequency import numpy as np import numpy.testing as npt def test_util_frequency_to_midi_note(): npt.assert_almost_equal(frequency_to_midi_note(261.6255653005986), 60) npt.assert_almost_equal(frequency_to_mi...
[69, 60])
assert_*
collection
tests/test_util.py
test_util_frequency_to_midi_note
45
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def example_function(a, b, foo, bar="bar"): assert a == 1 assert b == 2 assert foo ==
"foo"
assert
string_literal
tests/test_timeline_event.py
example_function
163
null
ideoforms/isobar
import pytest import isobar as iso def test_prange(): a = iso.PRange(0, iso.PConstant(10), iso.PSequence([1, 2])) assert list(a) == [0, 1, 3, 4, 6, 7, 9] a = iso.PRange(500, -500, -250) assert list(a) ==
[500, 250, 0, -250]
assert
collection
tests/test_pattern_sequence.py
test_prange
24
null
ideoforms/isobar
from . import dummy_timeline def test_track_mute_vs_solo(dummy_timeline): track1 = dummy_timeline.schedule({"note": 60}) track2 = dummy_timeline.schedule({"note": 62}) # Verify initial state dummy_timeline.tick() assert len([e for e in dummy_timeline.output_device.events if e[1] == 'note_on']) == ...
1
assert
numeric_literal
tests/test_track_solo.py
test_track_mute_vs_solo
80
null
ideoforms/isobar
import isobar as iso import pytest import time from isobar.io import DummyOutputDevice, MidiOutputDevice from . import dummy_timeline from isobar.exceptions import InvalidEventException def test_timeline_unschedule(dummy_timeline): events = { iso.EVENT_NOTE: iso.PSequence([1]), iso.EVENT_GATE: 0.5 ...
4
assert
numeric_literal
tests/test_timeline.py
test_timeline_unschedule
143
null
ideoforms/isobar
from isobar.pattern import PSequence from isobar.notation import parse_notation def test_shorthand_notation_parser(): seq = parse_notation('1 -2 [10 11] [c#4 [30.1 -30.2 30.3]]') expected = [1, -2, 10, 'c#4', 1, -2, 11, 30.1, 1, -2, 10, 'c#4', 1, -2, 11, -30.2] assert seq ==
expected
assert
variable
tests/test_shorthand_notation.py
test_shorthand_notation_parser
7
null
ideoforms/isobar
import pytest import isobar as iso def test_ppatterngeneratoraction(): n = 0 def generate(): nonlocal n n += 1 if n == 1: return iso.PSequence([0], 2) elif n == 2: return iso.PSequence([1, 2], 1) else: return None a = iso.PPatter...
StopIteration)
pytest.raises
variable
tests/test_pattern_sequence.py
test_ppatterngeneratoraction
179
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_invalid_properties(dummy_timeline): dummy_timeline.schedule({ "note": 0, "foo": "bar" }) with pytest.raises(
ValueError)
pytest.raises
variable
tests/test_timeline_event.py
test_event_invalid_properties
199
null
ideoforms/isobar
import isobar as iso import pytest from . import dummy_timeline def dummy_track(): return iso.Track(output_device=iso.io.DummyOutputDevice()) def test_track_is_finished_after_last_note(dummy_timeline): track = dummy_timeline.add_track(name="test_track", remove_when_done=False) note1 = iso.MidiNoteInstanc...
False
assert
bool_literal
tests/test_timeline_track.py
test_track_is_finished_after_last_note
133
null
ideoforms/isobar
import isobar as iso from isobar.io.midi import MidiInputDevice, MidiOutputDevice import pytest import time from . import dummy_timeline VIRTUAL_DEVICE_NAME = "Virtual Device" no_midi = False @pytest.mark.skipif(no_midi, reason="Device does not have MIDI support") def test_io_midi_sync(): tempo = 150 midi_ou...
tempo, rel=0.03)
pytest.approx
complex_expr
tests/test_io_midi.py
test_io_midi_sync
53
null
ideoforms/isobar
import pytest import isobar as iso def test_ppatterngeneratoraction(): n = 0 def generate(): nonlocal n n += 1 if n == 1: return iso.PSequence([0], 2) elif n == 2: return iso.PSequence([1, 2], 1) else: return None a = iso.PPatter...
1
assert
numeric_literal
tests/test_pattern_sequence.py
test_ppatterngeneratoraction
177
null
ideoforms/isobar
from isobar import midi_note_to_note_name, note_name_to_midi_note, frequency_to_midi_note, midi_note_to_frequency import numpy as np import numpy.testing as npt def test_util_note_name_to_midi_note(): assert note_name_to_midi_note('C-1') == 60 - 60 assert note_name_to_midi_note('C0') == 60 - 48 assert note...
0
assert
numeric_literal
tests/test_util.py
test_util_note_name_to_midi_note
35
null
ideoforms/isobar
import pytest import isobar as iso def test_pref(): a = iso.PSequence([1, 2, 3], 1) b = iso.PSequence([4, 5, 6], 1) c = iso.PRef(a) assert next(c) == 1 assert next(c) == 2 c.pattern = b assert next(c) ==
4
assert
numeric_literal
tests/test_pattern_core.py
test_pref
11
null
ideoforms/isobar
import pytest import isobar as iso def test_pfunc(): s = "abc" a = iso.PSequence([0, 1, 2], 1) b = iso.PFunc(lambda: s[next(a)]) assert next(b) ==
'a'
assert
string_literal
tests/test_pattern_core.py
test_pfunc
21
null
ideoforms/isobar
from . import dummy_timeline def test_track_mute(dummy_timeline): """ Test basic mute functionality. """ track1 = dummy_timeline.schedule({"note": 60}) track2 = dummy_timeline.schedule({"note": 62}) # Neither track muted: both should play dummy_timeline.tick() assert dummy_timeline.out...
[ [1, 'note_off', 60, 0], [1, 'note_off', 62, 0], [1, 'note_on', 62, 64, 0] ]
assert
collection
tests/test_track_mute.py
test_track_mute
25
null
ideoforms/isobar
from isobar import midi_note_to_note_name, note_name_to_midi_note, frequency_to_midi_note, midi_note_to_frequency import numpy as np import numpy.testing as npt def test_util_midi_note_to_frequency(): npt.assert_almost_equal(midi_note_to_frequency(60), 261.6255653005986) npt.assert_almost_equal(midi_note_to_f...
440)
assert_*
numeric_literal
tests/test_util.py
test_util_midi_note_to_frequency
52
null
ideoforms/isobar
import pytest import isobar as iso def test_pindexof(): a = iso.PSequence([1, 2, 3, 7, None, 1], 1) b = iso.PSequence([[ 1, 2, 3, 4], [ 5, 6, 7, 8 ]]) c = iso.PIndexOf(b, a) assert list(c) ==
[0, None, 2, 2, None, None]
assert
collection
tests/test_pattern_scalar.py
test_pindexof
85
null
ideoforms/isobar
import pytest import isobar as iso def test_parpeggiator(): a = iso.PArpeggiator([0, 1, 2, 3], iso.PArpeggiator.UP) assert a.nextn(16) == [0, 1, 2, 3] a = iso.PArpeggiator([0, 1, 2, 3], iso.PArpeggiator.DOWN) assert a.nextn(16) == [3, 2, 1, 0] a = iso.PArpeggiator([0, 1, 2, 3], iso.PArpeggiator.C...
[0, 3, 1, 2]
assert
collection
tests/test_pattern_sequence.py
test_parpeggiator
131
null
ideoforms/isobar
from isobar import midi_note_to_note_name, note_name_to_midi_note, frequency_to_midi_note, midi_note_to_frequency import numpy as np import numpy.testing as npt def test_util_midi_note_to_note_name(): assert midi_note_to_note_name(60 - 60) == 'C-1' assert midi_note_to_note_name(60 - 48) == 'C0' assert midi...
'C4'
assert
string_literal
tests/test_util.py
test_util_midi_note_to_note_name
14
null
ideoforms/isobar
from . import dummy_timeline def test_track_solo(dummy_timeline): track1 = dummy_timeline.schedule({"note": 60}) track2 = dummy_timeline.schedule({"note": 62}) # Neither track soloed: both should play dummy_timeline.tick() assert dummy_timeline.output_device.events ==
[ [0, 'note_on', 60, 64, 0], [0, 'note_on', 62, 64, 0] ]
assert
collection
tests/test_track_solo.py
test_track_solo
9
null
ideoforms/isobar
import isobar as iso def test_pattern_add(): p1 = iso.PSequence([1, 2, 3], 1) assert list(p1 + 1.5) == [2.5, 3.5, 4.5] assert list(-1 + p1) ==
[0, 1, 2]
assert
collection
tests/test_pattern_operators.py
test_pattern_add
8
null
ideoforms/isobar
import pytest import isobar as iso def test_plinlin(): a = iso.PSequence([4, 5, 1, -2, 1, -1.5], 1) b = iso.PScaleLinLin(a, 0, 10, 100, 200) assert list(b) ==
[140, 150, 110, 80, 110, 85]
assert
collection
tests/test_pattern_scalar.py
test_plinlin
50
null
ideoforms/isobar
from isobar import midi_note_to_note_name, note_name_to_midi_note, frequency_to_midi_note, midi_note_to_frequency import numpy as np import numpy.testing as npt def test_util_midi_note_to_note_name(): assert midi_note_to_note_name(60 - 60) == 'C-1' assert midi_note_to_note_name(60 - 48) == 'C0' assert midi...
'C3'
assert
string_literal
tests/test_util.py
test_util_midi_note_to_note_name
12
null
ideoforms/isobar
import isobar as iso import pytest import time from isobar.io import DummyOutputDevice, MidiOutputDevice from . import dummy_timeline from isobar.exceptions import InvalidEventException def test_timeline_reset(dummy_timeline): track = dummy_timeline.schedule({ iso.EVENT_NOTE: iso.PSequence([1, 2], 1), ...
6
assert
numeric_literal
tests/test_timeline.py
test_timeline_reset
261
null
ideoforms/isobar
import pytest import isobar as iso from . import dummy_timeline @pytest.mark.skip def test_lfo(dummy_timeline): lfo = iso.LFO(dummy_timeline, "sine", 1.0) assert lfo.value ==
0.5
assert
numeric_literal
tests/test_timeline_lfo.py
test_lfo
10
null
ideoforms/isobar
import isobar as iso from isobar.io.midi import MidiInputDevice, MidiOutputDevice import pytest import time from . import dummy_timeline VIRTUAL_DEVICE_NAME = "Virtual Device" no_midi = False @pytest.mark.skipif(no_midi, reason="Device does not have MIDI support") def test_io_midi(): """ Send a MIDI message ...
2
assert
numeric_literal
tests/test_io_midi.py
test_io_midi
40
null
ideoforms/isobar
import pytest import isobar as iso def test_pskipif(): a = iso.PSequence([1, 2, -1, 0, 4], 1) b = iso.PSequence([0, 1, False, True, None]) c = iso.PSkipIf(a, b) assert list(c) ==
[1, None, -1, None, 4]
assert
collection
tests/test_pattern_scalar.py
test_pskipif
27
null
ideoforms/isobar
import pytest import isobar as iso def test_pattern_stopiteration(): p = iso.PSequence([1, 2, 3], 1) assert next(p) == 1 assert next(p) ==
2
assert
numeric_literal
tests/test_pattern.py
test_pattern_stopiteration
9
null
ideoforms/isobar
import isobar as iso import pytest import time from isobar.io import DummyOutputDevice, MidiOutputDevice from . import dummy_timeline from isobar.exceptions import InvalidEventException def test_timeline_tempo(dummy_timeline): # Set tempo of internal clock dummy_timeline.clock_source = iso.Clock(dummy_timeline...
180
assert
numeric_literal
tests/test_timeline.py
test_timeline_tempo
332
null