Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Yikai-Liao committed Sep 18, 2024
1 parent 04dfacc commit 01af1b5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/test_filter.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from symusic import Score, Track, Note
from symusic import Note, Score, Track


def test_filter_notes():
track = Track(notes=[Note(0, 4, 72, 72), Note(4, 6, 72, 72), Note(8, 4, 72, 72)])

notes1 = track.notes.filter(lambda n: n.start < 6, inplace=False)
assert list(notes1) == [Note(0, 4, 72, 72), Note(4, 6, 72, 72)]
assert list(track.notes) == [Note(0, 4, 72, 72), Note(4, 6, 72, 72), Note(8, 4, 72, 72)]
assert list(track.notes) == [
Note(0, 4, 72, 72),
Note(4, 6, 72, 72),
Note(8, 4, 72, 72),
]

notes2 = track.notes.filter(lambda n: n.start > 6, inplace=True)
assert list(notes2) == [Note(8, 4, 72, 72)]
Expand All @@ -26,4 +30,4 @@ def test_filter_tracks():

tracks2 = score.tracks.filter(lambda t: t.name in ["A", "C"], inplace=True)
assert list(tracks2) == [t_a, t_c]
assert list(score.tracks) == [t_a, t_c]
assert list(score.tracks) == [t_a, t_c]

0 comments on commit 01af1b5

Please sign in to comment.