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
ideoforms/isobar
import isobar as iso import pytest def test_key_get(): a = iso.Key("C", "major") assert a.get(0) == a[0] == 0 assert a.get(1) ==
a[1]
assert
complex_expr
tests/test_key.py
test_key_get
31
null
ideoforms/isobar
import isobar as iso import pytest def test_key_get(): a = iso.Key("C", "major") assert a.get(0) ==
a[0]
assert
complex_expr
tests/test_key.py
test_key_get
30
null
ideoforms/isobar
import pytest import isobar as iso def test_pchanged(): a = iso.PSequence([1, 1, 2, 3, 3, "a", "a", "b", None, None, 1], 1) b = iso.PChanged(a) assert next(b) ==
0
assert
numeric_literal
tests/test_pattern_scalar.py
test_pchanged
8
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_count(dummy_timeline): dummy_timeline.schedule({ iso.EVENT_NOTE: iso.PSeries(0, 1), is...
8
assert
numeric_literal
tests/test_timeline.py
test_timeline_schedule_count
237
null
ideoforms/isobar
import isobar as iso def test_pattern_mod(): p1 = iso.PSequence([1, 2, 3], 1) assert list(p1 % 2) ==
[1, 0, 1]
assert
collection
tests/test_pattern_operators.py
test_pattern_mod
47
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...
np.ndarray
assert
complex_expr
tests/test_util.py
test_util_frequency_to_midi_note
48
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
assert
numeric_literal
tests/test_pattern_core.py
test_pref
9
null
ideoforms/isobar
import pytest import isobar as iso from . import dummy_timeline def test_pglobals(): with pytest.raises(KeyError): iso.Globals.get("key") iso.Globals.set("key", iso.Key("C", "major")) assert iso.Globals.get("key") ==
iso.Key("C", "major")
assert
func_call
tests/test_pattern_static.py
test_pglobals
10
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...
[1, 2, 3]
assert
collection
tests/test_pattern_core.py
test_pdict
57
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_replace(dummy_timeline): track1 = dummy_timeline.schedule({"note": 60}, name="foo") track2 = dummy_timeline.schedule({"note": 61}, name="bar") tr...
track3
assert
variable
tests/test_timeline_track.py
test_track_replace
25
null
ideoforms/isobar
import pytest import isobar as iso def test_psequence_ints(): a = iso.PSequence([1, 2, 3], 1) assert list(a) ==
[1, 2, 3]
assert
collection
tests/test_pattern_sequence.py
test_psequence_ints
6
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']) == ...
0
assert
numeric_literal
tests/test_track_solo.py
test_track_mute_vs_solo
90
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...
60
assert
numeric_literal
tests/test_util.py
test_util_note_name_to_midi_note
28
null
ideoforms/isobar
import isobar as iso def test_pattern_lshift(): p1 = iso.PSequence([1, 2, 3], 1) assert list(p1 << 1) ==
[2, 4, 6]
assert
collection
tests/test_pattern_operators.py
test_pattern_lshift
63
null
ideoforms/isobar
import pytest import isobar as iso def test_pnearest(): a = iso.PNearestNoteInKey(iso.PSequence([0, 1, 2, 3, -1, None, 12.5], 1), iso.Key("C", "major")) assert list(a) ==
[0, 0, 2, 2, -1, None, 12]
assert
collection
tests/test_pattern_tonal.py
test_pnearest
18
null
ideoforms/isobar
import isobar as iso import pytest import time def test_timeline_clock_accuracy(): #-------------------------------------------------------------------------------- # 480 ticks per beat @ 125bpm = 1 tick per 1ms #-------------------------------------------------------------------------------- timeline ...
dt
assert
variable
tests/test_timeline_clock.py
test_timeline_clock_accuracy
25
null
ideoforms/isobar
import pytest import isobar as iso def test_pattern_all(): p = iso.PSequence([1, 2, 3], 1) assert p.all() == [1, 2, 3] # check that the sequence is reset afterwards assert p.all() == [1, 2, 3] p = iso.PSequence([1, 2, 3], 1) assert p.all(2) ==
[1, 2]
assert
collection
tests/test_pattern.py
test_pattern_all
35
null
ideoforms/isobar
import pytest import isobar as iso def test_pdictkey(): d1 = {"foo": "bar", "baz": "buzz"} d2 = {"foo": "boo", "baz": "bez"} a = iso.PSequence(["foo", "baz"], 1) b = iso.PDictKey(iso.PSequence([d1, d2]), a) assert list(b) ==
["bar", "bez"]
assert
collection
tests/test_pattern_core.py
test_pdictkey
65
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_fr...
[None, None]
assert
collection
tests/test_util.py
test_util_midi_note_to_frequency
53
null
ideoforms/isobar
import isobar as iso def test_plsystem(): a = iso.PLSystem("N[-N++N]-N", 1) assert list(a) ==
[0, -1, 1, -1]
assert
collection
tests/test_pattern_lsystem.py
test_plsystem
5
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_replace(dummy_timeline): track1 = dummy_timeline.schedule({"note": 60}, name="foo") track2 = dummy_timeline.schedule({"note": 61}, name="bar") tr...
62
assert
numeric_literal
tests/test_timeline_track.py
test_track_replace
26
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', ...
[ [2, 'note_off', 60, 0], [2, 'note_on', 60, 64, 0], [2, 'note_on', 62, 64, 0] ]
assert
collection
tests/test_track_solo.py
test_track_solo
32
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_action(dummy_timeline): dummy_timeline.event_times = [] def increment_counter(): dummy_timeline.event_times.append(dummy_timeline.current_time) if len(dummy_timeline.event_times) >= 5: ...
pytest.approx([0, 1, 2, 3, 4])
assert
func_call
tests/test_timeline_event.py
test_event_action
155
null
ideoforms/isobar
import pytest import isobar as iso def test_pattern_timeline(): p = iso.PSequence([1, 2, 3], 1) assert p.timeline is
None
assert
none_literal
tests/test_pattern.py
test_pattern_timeline
57
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_add_remove_note(dummy_timeline): track = dummy_timeline.schedule(name="test_track") notes = [] for index, n in enumerate([60, 62, 64, 65, 67]): ...
5
assert
numeric_literal
tests/test_timeline_track.py
test_track_add_remove_note
110
null
ideoforms/isobar
import pytest import isobar as iso from . import dummy_timeline def test_pstaticpattern(dummy_timeline): pattern = iso.PStaticPattern(pattern=iso.PSequence([1, 2, 3, 4], 1), element_duration=iso.PSequence([1, 2, 0, 1])) dummy_timeline.schedule({ "note": pattern }) ...
[0, 1, 1, 2, 2, 3, 3, 4]
assert
collection
tests/test_pattern_static.py
test_pstaticpattern
26
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_note_octave(dummy_timeline): dummy_timeline.schedule({ iso.EVENT_NOTE: iso.PSequence([0, 1, 2, 3], 1), iso.EVENT_DURATION: 1.0, iso.EVENT_OCTAVE: iso.PSequence([2, 4]) }) dummy_t...
[ [0, 'note_on', 24, 64, 0], [1, 'note_off', 24, 0], [1, 'note_on', 49, 64, 0], [2, 'note_off', 49, 0], [2, 'note_on', 26, 64, 0], [3, 'note_off', 26, 0], [3, 'note_on', 51, 64, 0], [4, 'note_off', 51, 0] ]
assert
collection
tests/test_timeline_event.py
test_event_note_octave
45
null
ideoforms/isobar
import pytest import isobar as iso def test_pbrown(): a = iso.PBrown(0, iso.PConstant(5), iso.PConstant(-5), iso.PConstant(5)) a.seed(0) expected = [0, 1, 2, -3, -4, -1, 1, 2, 1, 3, 3, 5, 3, 5, 2, 1, -2, -5, -1, -2] assert a.nextn(20) ==
expected
assert
variable
tests/test_pattern_chance.py
test_pbrown
21
null
ideoforms/isobar
import isobar as iso def test_plsystem(): a = iso.PLSystem("N[-N++N]-N", 1) assert list(a) == [0, -1, 1, -1] a = iso.PLSystem("N[-N++N]-N", 2) assert list(a) ==
[0, -1, 1, -1, -2, -3, -1, -3, -1, -2, 0, -2, -2, -3, -1, -3]
assert
collection
tests/test_pattern_lsystem.py
test_plsystem
8
null
ideoforms/isobar
import isobar as iso def test_pattern_mod(): p1 = iso.PSequence([1, 2, 3], 1) assert list(p1 % 2) == [1, 0, 1] assert list(2 % p1) ==
[0, 0, 2]
assert
collection
tests/test_pattern_operators.py
test_pattern_mod
48
null
ideoforms/isobar
import pytest import isobar as iso def test_pinterpolate(): a = iso.PSequence([0, 1, 2], 1) steps = iso.PSequence([4, 2], 1) b = iso.PInterpolate(a, steps, iso.INTERPOLATION_NONE) assert list(b) == [0, 0, 0, 0, 1, 1, 2] a = iso.PSequence([0, 1, 2], 1) steps = iso.PSequence([4, 2], 1) b = i...
ValueError)
pytest.raises
variable
tests/test_pattern_sequence.py
test_pinterpolate
76
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_callbacks(dummy_timeline): track_events = [] timeline_events = [] def track_callback(event): track_events.append(event) assert e...
2
assert
numeric_literal
tests/test_timeline_track.py
test_track_callbacks
94
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_chord_2(dummy_timeline): dummy_timeline.schedule({ iso.EVENT_NOTE: iso.PSequence([(1, 2, 3), (4, 5, 6)], 1), iso.EVENT_GATE: (1, 2, 3), iso.EVENT_AMPLITUDE: iso.PSequence([(10, 20, 30), ...
[ [0, 'note_on', 1, 10, 0], [0, 'note_on', 2, 20, 0], [0, 'note_on', 3, 30, 0], [1, 'note_off', 1, 0], [1, 'note_on', 4, 40, 0], [1, 'note_on', 5, 50, 0], [1, 'note_on', 6, 60, 0], [2, 'note_off', 2, 0], [2, 'note_off', 4, 0], [3, 'note_off', 3, 0], [3, 'note_off', 5, 0], [4, 'note_off', 6, 0] ]
assert
collection
tests/test_timeline_event.py
test_event_chord_2
127
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
string_literal
tests/test_pattern_core.py
test_pfunc
22
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 values = [] def action(t): nonlocal values values.append(t) dummy_timeline.schedule({ "action": action, "a...
[0.0, 1.0]
assert
collection
tests/test_pattern_static.py
test_pcurrenttime
52
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 track_callback(event): track_events.append(event) assert event.output_device == dummy_timeline.output_device assert event.track ==
track
assert
variable
tests/test_timeline_track.py
track_callback
82
null
ideoforms/isobar
import pytest import isobar as iso from . import dummy_timeline def test_pstaticpattern(dummy_timeline): pattern = iso.PStaticPattern(pattern=iso.PSequence([1, 2, 3, 4], 1), element_duration=iso.PSequence([1, 2, 0, 1])) dummy_timeline.schedule({ "note": pattern }) ...
[1, 1, 2, 2, 2, 2, 4, 4]
assert
collection
tests/test_pattern_static.py
test_pstaticpattern
27
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 ...
0
assert
numeric_literal
tests/test_timeline.py
test_timeline_unschedule
145
null
ideoforms/isobar
import isobar as iso import pytest def test_key_contains(): a = iso.Key("C", "major") assert 0 in
a
assert
variable
tests/test_key.py
test_key_contains
38
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
numeric_literal
tests/test_timeline_event.py
example_function
161
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_dur(dummy_timeline): dummy_timeline.schedule({ iso.EVENT_NOTE: iso.PSequence([1, 2, 3]), iso.EVENT_DURATION: iso.PSequence([1, 1.5, 2, 1.5], 1) }) dummy_timeline.run() assert dummy_...
[ [0, 'note_on', 1, 64, 0], [1, 'note_off', 1, 0], [1, 'note_on', 2, 64, 0], [2.5, 'note_off', 2, 0], [2.5, 'note_on', 3, 64, 0], [4.5, 'note_off', 3, 0], [4.5, 'note_on', 1, 64, 0], [6, 'note_off', 1, 0] ]
assert
collection
tests/test_timeline_event.py
test_event_dur
72
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_chord(dummy_timeline): dummy_timeline.schedule({ iso.EVENT_NOTE: iso.PSequence([(0, 7), 4, (2, 9, 11), 7], 1), iso.EVENT_DURATION: iso.PSequence([1, 2]), iso.EVENT_AMPLITUDE: iso.PSequen...
[ [0, 'note_on', 0, 10, 0], [0, 'note_on', 7, 10, 0], [1, 'note_off', 0, 0], [1, 'note_off', 7, 0], [1, 'note_on', 4, 20, 0], [3, 'note_off', 4, 0], [3, 'note_on', 2, 30, 0], [3, 'note_on', 9, 30, 0], [3, 'note_on', 11, 30, 0], [4, 'note_off', 2, 0], [4, 'note_off', 9, 0], [4, 'note_off', 11, 0], [4, 'note_on', 7, 10, ...
assert
collection
tests/test_timeline_event.py
test_event_chord
103
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...
list
assert
variable
tests/test_util.py
test_util_frequency_to_midi_note
47
null
ideoforms/isobar
import isobar as iso def test_pmarkov(): a = iso.PMarkov([1, 1, 2, 3, 1]) a.seed(0) assert a.nextn(16) == [3, 1, 2, 3, 1, 2, 3, 1, 1, 1, 2, 3, 1, 2, 3, 1] a.reset() assert a.nextn(16) == [3, 1, 2, 3, 1, 2, 3, 1, 1, 1, 2, 3, 1, 2, 3, 1] a = iso.PMarkov({1: [2, 2, 3], 2: [3], 3: [1, 2]}) a.s...
[3, 1, 2, 3, 2, 3, 2, 3, 1, 3, 1, 2, 3, 1, 3, 2]
assert
collection
tests/test_pattern_markov.py
test_pmarkov
12
null
ideoforms/isobar
import isobar as iso import pytest def test_key_random(): a = iso.Key.random() assert a.tonic >= 0 and a.tonic < 12 assert len(a.semitones) > 0 assert len(a.semitones) <=
12
assert
numeric_literal
tests/test_key.py
test_key_random
92
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)
assert_*
numeric_literal
tests/test_util.py
test_util_midi_note_to_frequency
51
null
ideoforms/isobar
import pytest import isobar as iso def test_pcollapse(): a = iso.PSequence([1, 2, None, 3, 4, None, None, 5, 6, None], 1) b = iso.PCollapse(a) assert list(b) ==
[1, 2, 3, 4, 5, 6]
assert
collection
tests/test_pattern_sequence.py
test_pcollapse
98
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....
True
assert
bool_literal
tests/test_timeline_track.py
test_track_defaults
153
null
ideoforms/isobar
import pytest import isobar as iso def test_pint(): a = iso.PSequence([4, 5, 1.2, -2.9, None, 1, -1.5], 1) b = iso.PInt(a) assert list(b) ==
[4, 5, 1, -2, None, 1, -1]
assert
collection
tests/test_pattern_core.py
test_pint
82
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]
assert
collection
tests/test_pattern_sequence.py
test_prange
22
null
ideoforms/isobar
import pytest import isobar as iso def test_pattern_value(): p1 = iso.PSequence([1, 2, 3], 1) assert iso.Pattern.value(p1) == 1 p1 = iso.PSequence([1, 2, 3], 1) p2 = iso.PSequence([ p1 ]) assert iso.Pattern.value(p2) == 1 assert iso.Pattern.value(1) == 1 assert iso.Pattern.value([1]) ==
[1]
assert
collection
tests/test_pattern.py
test_pattern_value
79
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_update(dummy_timeline): #-------------------------------------------------------------------------------- # Test that a track can be updated properly...
1
assert
numeric_literal
tests/test_timeline_track.py
test_track_update
46
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...
61
assert
numeric_literal
tests/test_util.py
test_util_note_name_to_midi_note
36
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_key(dummy_timeline): dummy_timeline.schedule({ iso.EVENT_DEGREE: iso.PSequence([0, 1, 2, 3], 1), iso.EVENT_KEY: iso.PSequence([iso.Key("C", "major"), iso.Key("F", "major")]), iso.EVENT_T...
[ [0, 'note_on', 12, 64, 0], [1, 'note_off', 12, 0], [1, 'note_on', 19, 64, 0], [2, 'note_off', 19, 0], [2, 'note_on', 16, 64, 0], [3, 'note_off', 16, 0], [3, 'note_on', 22, 64, 0], [4, 'note_off', 22, 0] ]
assert
collection
tests/test_timeline_event.py
test_event_key
59
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
numeric_literal
tests/test_pattern.py
test_pattern_stopiteration
8
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] p2 = iso.PSequence([2, 3, 4, 5], 1) assert list(p1 + p2) ==
[3, 5, 7]
assert
collection
tests/test_pattern_operators.py
test_pattern_add
11
null
ideoforms/isobar
import pytest import isobar as iso def test_pconcatenate(): a = iso.PSequence([1, 2], 1) b = iso.PSequence([3, 4], 1) c = iso.PSequence([5], 1) d = iso.PConcatenate([a, b, c]) assert list(d) ==
[1, 2, 3, 4, 5]
assert
collection
tests/test_pattern_core.py
test_pconcatenate
72
null
ideoforms/isobar
import isobar as iso import pytest from . import dummy_timeline def test_event_supercollider(dummy_timeline): output_device = DummySuperColliderOutputDevice() dummy_timeline.output_device = output_device dummy_timeline.schedule({ iso.EVENT_SUPERCOLLIDER_SYNTH: iso.PSequence([ "foo", "bar" ]), ...
[ ["foo", {"buffer": 1, "rate": 0.5}], ["bar", {"buffer": 2, "rate": 1}], ["foo", {"buffer": 1, "rate": 2}], ]
assert
collection
tests/test_timeline_event_supercollider.py
test_event_supercollider
26
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_generator(dummy_timeline): def custom_pattern(): for i in range(4): yield 60 + i * i dummy_timeline.schedule({ iso.EVENT_NOTE: custom_pattern(), iso.EVENT_DURATION: 1 ...
[ [0, 'note_on', 60, 64, 0], [1, 'note_off', 60, 0], [1, 'note_on', 61, 64, 0], [2, 'note_off', 61, 0], [2, 'note_on', 64, 64, 0], [3, 'note_off', 64, 0], [3, 'note_on', 69, 64, 0], [4, 'note_off', 69, 0], ]
assert
collection
tests/test_timeline_event.py
test_event_generator
211
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...
[0.0, 0.5, 0.5, 0.75, 0.75, 1.75, 1.75, 2.25, 2.25, 3.25, 3.25, 3.5, 3.5, 3.75, 3.75, 4.25, 4.25, 5.25, 5.25, 5.5, 5.5, 6.5, 6.5, 7.0, 7.0, 8.0, 8.0, 8.5, 8.5, 8.75, 8.75, 9.75, 9.75, 10.0, 10.0, 10.5]
assert
collection
tests/test_timeline_event.py
test_event_dict_permut
191
null
ideoforms/isobar
import isobar as iso import pytest def test_key_defaults(): a = iso.Key() assert a.get(0) == 0 assert a.get(1) ==
2
assert
numeric_literal
tests/test_key.py
test_key_defaults
9
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
numeric_literal
tests/test_timeline_event.py
example_function
162
null
ideoforms/isobar
import isobar as iso def test_chord(): chord = iso.Chord([3, 4, 3]) assert chord.intervals == [3, 4, 3] assert chord.root ==
0
assert
numeric_literal
tests/test_chord.py
test_chord
10
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_...
3)
pytest.approx
numeric_literal
tests/test_timeline.py
test_timeline_seconds_to_beats
323
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 values = [] def action(t): nonlocal values values.append(t) dummy_timeline.schedule({ "action": action, "a...
[0.0]
assert
collection
tests/test_pattern_static.py
test_pcurrenttime
47
null
ideoforms/isobar
import pytest import isobar as iso def test_pround(): # Note that Python3 rounds x.5 to the nearest even number a = iso.PSequence([0, 0.1, 0.5, 1, 1.5, None, -3.9], 1) b = iso.PRound(a) assert list(b) ==
[0, 0, 0, 1, 2, None, -4]
assert
collection
tests/test_pattern_scalar.py
test_pround
62
null
ideoforms/isobar
import pytest import isobar as iso def test_pattern_copy(): p1 = iso.PSequence([1, 2, 3], 1) p2 = p1.copy() assert p1.all() ==
p2.all()
assert
func_call
tests/test_pattern.py
test_pattern_copy
63
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....
48
assert
numeric_literal
tests/test_timeline_track.py
test_track_defaults
150
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]
assert
collection
tests/test_pattern_scalar.py
test_pscalar
71
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_add_remove_note(dummy_timeline): track = dummy_timeline.schedule(name="test_track") notes = [] for index, n in enumerate([60, 62, 64, 65, 67]): ...
4
assert
numeric_literal
tests/test_timeline_track.py
test_track_add_remove_note
114
null
ideoforms/isobar
import pytest import isobar as iso def test_pabs(): a = iso.PSequence([4, 5, 1, -2, None, 1, -1.5], 1) b = iso.PAbs(a) assert list(b) ==
[4, 5, 1, 2, None, 1, 1.5]
assert
collection
tests/test_pattern_core.py
test_pabs
77
null
ideoforms/isobar
import pytest import isobar as iso def test_parrayindex_pattern(): a = iso.PConstant(5) b = iso.PConstant(9) c = iso.PArrayIndex([a, b], iso.PSequence([0, 1], 2)) assert list(c) ==
[5, 9, 5, 9]
assert
collection
tests/test_pattern_core.py
test_parrayindex_pattern
41
null
ideoforms/isobar
import pytest import isobar as iso def test_pwrap(): a = iso.PSequence([0, 0.1, 0.5, 1, 1.5, -3.9], 1) b = iso.PWrap(a, 1, 2) assert list(b) ==
[1.0, 1.1, 1.5, 1, 1.5, 1.1]
assert
collection
tests/test_pattern_scalar.py
test_pwrap
79
null
ideoforms/isobar
import isobar as iso import pytest def test_key_defaults(): a = iso.Key() assert a.get(0) ==
0
assert
numeric_literal
tests/test_key.py
test_key_defaults
8
null
ideoforms/isobar
import isobar as iso import pytest import math from . import dummy_timeline def test_event_control_linear_interpolation(dummy_timeline): """ Linear interpolation between control points. """ control_series = iso.PSequence([1, 3, 2], 1) dummy_timeline.ticks_per_beat = 10 dummy_timeline.schedule({...
values, rel=0.01)
pytest.approx
complex_expr
tests/test_timeline_event_control.py
test_event_control_linear_interpolation
47
null
ideoforms/isobar
import isobar as iso def test_chord(): chord = iso.Chord([3, 4, 3]) assert chord.intervals == [3, 4, 3] assert chord.root == 0 assert chord.semitones == [0, 3, 7, 10] chord = iso.Chord([3, 4, 3], root=3) assert chord.intervals == [3, 4, 3] assert chord.root ==
3
assert
numeric_literal
tests/test_chord.py
test_chord
15
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...
[ [2, 'note_on', 60, 64, 0], [2, 'note_off', 62, 0], [2, 'note_on', 62, 64, 0] ]
assert
collection
tests/test_track_mute.py
test_track_mute
38
null
ideoforms/isobar
import pytest import isobar as iso def test_pdegree(): a = iso.PDegree(iso.PSequence([0, 1, -1, None, 7], 1)) assert list(a) == [0, 2, -1, None, 12] # Test on array values a = iso.PDegree(iso.PSequence([[0, 1], [2, 3], [None, -1]], 1)) assert list(a) ==
[(0, 2), (4, 5), (None, -1)]
assert
collection
tests/test_pattern_tonal.py
test_pdegree
10
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 mid...
'C1'
assert
string_literal
tests/test_util.py
test_util_midi_note_to_note_name
10
null
ideoforms/isobar
import pytest import isobar as iso def test_pattern_len(): p = iso.PSequence([1, 2, 3], 1) assert len(p) == 3 p = iso.PSequence([1, 2, 3], 0) assert len(p) ==
0
assert
numeric_literal
tests/test_pattern.py
test_pattern_len
19
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]
assert
collection
tests/test_pattern_sequence.py
test_parpeggiator
125
null
ideoforms/isobar
import isobar as iso def test_pattern_eq(): p1 = iso.PSequence([1, 2, 3], 1) assert list(p1 == 2) ==
[0, 1, 0]
assert
collection
tests/test_pattern_operators.py
test_pattern_eq
79
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
string_literal
tests/test_util.py
test_util_midi_note_to_note_name
9
null
ideoforms/isobar
import pytest import isobar as iso from . import dummy_timeline def test_pglobals(): with pytest.raises(
KeyError)
pytest.raises
variable
tests/test_pattern_static.py
test_pglobals
6
null
ideoforms/isobar
import isobar as iso def test_chord(): chord = iso.Chord([3, 4, 3]) assert chord.intervals == [3, 4, 3] assert chord.root == 0 assert chord.semitones ==
[0, 3, 7, 10]
assert
collection
tests/test_chord.py
test_chord
11
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), ...
0.0
assert
numeric_literal
tests/test_timeline.py
test_timeline_reset
257
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....
pytest.approx(values, rel=0.0000001)
assert
func_call
tests/test_timeline_event_control.py
test_event_control_linear_interpolation_zero_duration
62
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_action(dummy_timeline): dummy_timeline.event_times = [] def increment_counter(): dummy_timeline.event_times.append(dummy_timeline.current_time) if len(dummy_timeline.event_times) >= 5: ...
[0, 1, 2, 3, 4])
pytest.approx
collection
tests/test_timeline_event.py
test_event_action
155
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] p2 = iso.PSequence([2, 3, 4, 5], 1) assert list(p2 - p1) ==
[1, 1, 1]
assert
collection
tests/test_pattern_operators.py
test_pattern_sub
19
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 next(c) == 5 assert next(c) ==
6
assert
numeric_literal
tests/test_pattern_core.py
test_pref
13
null
ideoforms/isobar
from random import random import isobar as iso import pytest from . import dummy_timeline def test_event_gate(dummy_timeline): dummy_timeline.schedule({ iso.EVENT_NOTE: iso.PSequence([1, 2, 3, 4, 5], 1), iso.EVENT_DURATION: iso.PSequence([1, 2]), iso.EVENT_GATE: iso.PSequence([0.5, 1, 1.5])...
[ [0, 'note_on', 1, 64, 0], [0.5, 'note_off', 1, 0], [1, 'note_on', 2, 64, 0], [3, 'note_off', 2, 0], [3, 'note_on', 3, 64, 0], [4, 'note_on', 4, 64, 0], [4.5, 'note_off', 3, 0], [5, 'note_off', 4, 0], [6, 'note_on', 5, 64, 0], [7, 'note_off', 5, 0], ]
assert
collection
tests/test_timeline_event.py
test_event_gate
86
null
ideoforms/isobar
import pytest import isobar as iso def test_pround(): # Note that Python3 rounds x.5 to the nearest even number a = iso.PSequence([0, 0.1, 0.5, 1, 1.5, None, -3.9], 1) b = iso.PRound(a) assert list(b) == [0, 0, 0, 1, 2, None, -4] assert all(x is None or type(x) == int for x in list(b)) a = iso...
[40, 60, 0, -10, None, 1000]
assert
collection
tests/test_pattern_scalar.py
test_pround
67
null
ideoforms/isobar
import isobar as iso import pytest import math from . import dummy_timeline def test_event_control_cosine_interpolation(dummy_timeline): """ Linear interpolation between control points. """ alternator = iso.PSequence([0, 1]) dummy_timeline.ticks_per_beat = 10 dummy_timeline.schedule({ i...
values, rel=0.000001)
pytest.approx
complex_expr
tests/test_timeline_event_control.py
test_event_control_cosine_interpolation
82
null
machow/siuba
import pytest from siuba.dply.verbs import mutate, arrange, filter, ungroup from siuba.siu import _ import pandas as pd from pandas.testing import assert_frame_equal def df1(): yield pd.DataFrame({ "repo": ["pandas", "dplyr", "ggplot2", "plotnine"], "owner": ["pandas-dev", "tidyverse", "tidyverse"...
"a"
assert
string_literal
siuba/tests/test_dply_verbs.py
test_flatten_vars
79
null
machow/siuba
import pytest from siuba.siu.calls import PipeCall from siuba.siu.dispatchers import call from siuba.siu import _, strip_symbolic, Symbolic def test_siu_call_underscore_method(): assert "a,b" >> call(_.split(",")) ==
["a", "b"]
assert
collection
siuba/tests/test_siu_dispatchers.py
test_siu_call_underscore_method
50
null
machow/siuba
from siuba import _, group_by, ungroup, summarize, collect from siuba.dply.vector import row_number, n from siuba.dply import verbs import pytest from .helpers import assert_equal_query, data_frame, backend_notimpl, SqlBackend from string import ascii_lowercase DATA = data_frame(x = [1,2,3], y = [9,8,7], g = ['a', '...
("y",)
assert
collection
siuba/tests/test_verb_group_by.py
test_group_by_no_add
37
null
machow/siuba
from siuba import _, group_by, summarize, count, add_count, collect import pandas as pd import pytest from .helpers import assert_equal_query, data_frame, backend_notimpl, backend_sql DATA = data_frame(x = [1,2,3,4], g = ['a', 'a', 'b', 'b']) DATA2 = data_frame(x = [1,2,3,4], g = ['a', 'a', 'b', 'b'], h = ['c', 'c', ...
DATA.assign(n = 4))
assert_*
func_call
siuba/tests/test_verb_count.py
test_add_count_no_groups
88
null
machow/siuba
import pytest from siuba.dply.verbs import mutate, arrange, filter, ungroup from siuba.siu import _ import pandas as pd from pandas.testing import assert_frame_equal def df1(): yield pd.DataFrame({ "repo": ["pandas", "dplyr", "ggplot2", "plotnine"], "owner": ["pandas-dev", "tidyverse", "tidyverse"...
flatten_var(x)[0]
assert
func_call
siuba/tests/test_dply_verbs.py
test_flatten_vars_noop
89
null
machow/siuba
from siuba import _, group_by, mutate, filter, summarize from siuba.sql import sql_raw import sqlalchemy.exc import pytest from .helpers import assert_equal_query, data_frame, backend_sql DATA = data_frame(x = ['a','a'], y = [1,2]) def df(backend): return backend.load_df(DATA) @pytest.mark.skip_backend("snowfl...
exc)
pytest.raises
variable
siuba/tests/test_sql_misc.py
test_raw_sql_mutate_refer_previous_raise_dberror
39
null
machow/siuba
from siuba import ( _, group_by, join, inner_join, left_join, right_join, full_join, semi_join, anti_join ) from siuba.dply.vector import row_number, n from siuba.dply.verbs import collect import pytest from .helpers import assert_equal_query, assert_frame_sort_equal, data_frame, backen...
DF1.iloc[2:,])
assert_*
complex_expr
siuba/tests/test_verb_join.py
test_basic_anti_join_on_map
195
null