File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import requests_mock
4
4
5
+ from troi .patch import Patch
5
6
from troi import Artist , ArtistCredit , Recording , Playlist
6
7
import troi .filters
7
8
from troi .musicbrainz .recording import RecordingListElement
8
9
from troi .listenbrainz .feedback import ListensFeedbackLookup
9
10
10
11
12
+ class DummyPatch :
13
+
14
+ def __init__ (self ):
15
+ self .local_storage = {}
16
+
17
+ def set_patch_object (self , obj ):
18
+ pass
19
+
20
+
11
21
class TestArtistCreditFilterElement (unittest .TestCase ):
12
22
13
23
def test_artist_credit_filter_include (self ):
@@ -56,6 +66,7 @@ def test_artist_credit_limiter_higher_ranked(self):
56
66
Recording (mbid = '73a9d0db-0ec7-490e-9a85-0525a5ccef8e' , artist_credit = ArtistCredit (artist_credit_id = 197 ), ranking = .1 )
57
67
]
58
68
69
+
59
70
e = troi .filters .ArtistCreditLimiterElement (1 )
60
71
flist = e .read ([rlist ])
61
72
assert len (flist ) == 2
@@ -235,14 +246,17 @@ def test_never_listened_element(self):
235
246
Recording (mbid = 'c88b3490-35a0-460d-b3bc-bc50c8855d00' ),
236
247
Recording (mbid = '139654ae-2c02-4e0f-aee0-c47da6e59ff1' , listenbrainz = {"latest_listened_at" : 345345345 })
237
248
]
249
+ p = DummyPatch ()
238
250
e = troi .filters .NeverListenedFilterElement ()
251
+ e .set_patch_object (p )
239
252
flist = e .read ([rlist ])
240
253
assert len (flist ) == 2
241
254
242
255
assert flist [0 ].mbid == '8756f690-18ca-488d-a456-680fdaf234bd'
243
256
assert flist [1 ].mbid == '139654ae-2c02-4e0f-aee0-c47da6e59ff1'
244
257
245
258
e = troi .filters .NeverListenedFilterElement (remove_unlistened = False )
259
+ e .set_patch_object (p )
246
260
flist = e .read ([rlist ])
247
261
assert len (flist ) == 2
248
262
You can’t perform that action at this time.
0 commit comments