@@ -94,6 +94,20 @@ class RatingPlugin(plugins.BeetsPlugin):
94
94
out = self .run_with_output ("ls" , "rating:3..5" )
95
95
assert "aaa" not in out
96
96
97
+ def test_multi_value_flex_field_type (self ):
98
+ class MultiValuePlugin (plugins .BeetsPlugin ):
99
+ item_types = {"multi_value" : types .MULTI_VALUE_DSV }
100
+
101
+ self .register_plugin (MultiValuePlugin )
102
+
103
+ item = Item (path = "apath" , artist = "aaa" )
104
+ item .multi_value = ["one" , "two" , "three" ]
105
+ item .add (self .lib )
106
+
107
+ out = self .run_with_output ("ls" , "-f" , "$multi_value" )
108
+ delimiter = types .MULTI_VALUE_DSV .delimiter
109
+ assert out == f"one{ delimiter } two{ delimiter } three\n "
110
+
97
111
98
112
class ItemWriteTest (PluginLoaderTestCase ):
99
113
def setUp (self ):
@@ -183,9 +197,9 @@ def __init__(self):
183
197
184
198
def import_task_created_event (self , session , task ):
185
199
if (
186
- isinstance (task , SingletonImportTask )
187
- or isinstance (task , SentinelImportTask )
188
- or isinstance (task , ArchiveImportTask )
200
+ isinstance (task , SingletonImportTask )
201
+ or isinstance (task , SentinelImportTask )
202
+ or isinstance (task , ArchiveImportTask )
189
203
):
190
204
return task
191
205
@@ -362,16 +376,16 @@ def return_choices(self, session, task):
362
376
self .register_plugin (DummyPlugin )
363
377
# Default options + extra choices by the plugin ('Foo', 'Bar')
364
378
opts = (
365
- "Apply" ,
366
- "More candidates" ,
367
- "Skip" ,
368
- "Use as-is" ,
369
- "as Tracks" ,
370
- "Group albums" ,
371
- "Enter search" ,
372
- "enter Id" ,
373
- "aBort" ,
374
- ) + ("Foo" , "baR" )
379
+ "Apply" ,
380
+ "More candidates" ,
381
+ "Skip" ,
382
+ "Use as-is" ,
383
+ "as Tracks" ,
384
+ "Group albums" ,
385
+ "Enter search" ,
386
+ "enter Id" ,
387
+ "aBort" ,
388
+ ) + ("Foo" , "baR" )
375
389
376
390
self .importer .add_choice (Action .SKIP )
377
391
self .importer .run ()
@@ -398,14 +412,14 @@ def return_choices(self, session, task):
398
412
self .register_plugin (DummyPlugin )
399
413
# Default options + extra choices by the plugin ('Foo', 'Bar')
400
414
opts = (
401
- "Apply" ,
402
- "More candidates" ,
403
- "Skip" ,
404
- "Use as-is" ,
405
- "Enter search" ,
406
- "enter Id" ,
407
- "aBort" ,
408
- ) + ("Foo" , "baR" )
415
+ "Apply" ,
416
+ "More candidates" ,
417
+ "Skip" ,
418
+ "Use as-is" ,
419
+ "Enter search" ,
420
+ "enter Id" ,
421
+ "aBort" ,
422
+ ) + ("Foo" , "baR" )
409
423
410
424
config ["import" ]["singletons" ] = True
411
425
self .importer .add_choice (Action .SKIP )
@@ -435,16 +449,16 @@ def return_choices(self, session, task):
435
449
self .register_plugin (DummyPlugin )
436
450
# Default options + not dupe extra choices by the plugin ('baZ')
437
451
opts = (
438
- "Apply" ,
439
- "More candidates" ,
440
- "Skip" ,
441
- "Use as-is" ,
442
- "as Tracks" ,
443
- "Group albums" ,
444
- "Enter search" ,
445
- "enter Id" ,
446
- "aBort" ,
447
- ) + ("baZ" ,)
452
+ "Apply" ,
453
+ "More candidates" ,
454
+ "Skip" ,
455
+ "Use as-is" ,
456
+ "as Tracks" ,
457
+ "Group albums" ,
458
+ "Enter search" ,
459
+ "enter Id" ,
460
+ "aBort" ,
461
+ ) + ("baZ" ,)
448
462
self .importer .add_choice (Action .SKIP )
449
463
self .importer .run ()
450
464
self .mock_input_options .assert_called_once_with (
@@ -470,16 +484,16 @@ def foo(self, session, task):
470
484
self .register_plugin (DummyPlugin )
471
485
# Default options + extra choices by the plugin ('Foo', 'Bar')
472
486
opts = (
473
- "Apply" ,
474
- "More candidates" ,
475
- "Skip" ,
476
- "Use as-is" ,
477
- "as Tracks" ,
478
- "Group albums" ,
479
- "Enter search" ,
480
- "enter Id" ,
481
- "aBort" ,
482
- ) + ("Foo" ,)
487
+ "Apply" ,
488
+ "More candidates" ,
489
+ "Skip" ,
490
+ "Use as-is" ,
491
+ "as Tracks" ,
492
+ "Group albums" ,
493
+ "Enter search" ,
494
+ "enter Id" ,
495
+ "aBort" ,
496
+ ) + ("Foo" ,)
483
497
484
498
# DummyPlugin.foo() should be called once
485
499
with patch .object (DummyPlugin , "foo" , autospec = True ) as mock_foo :
@@ -512,16 +526,16 @@ def foo(self, session, task):
512
526
self .register_plugin (DummyPlugin )
513
527
# Default options + extra choices by the plugin ('Foo', 'Bar')
514
528
opts = (
515
- "Apply" ,
516
- "More candidates" ,
517
- "Skip" ,
518
- "Use as-is" ,
519
- "as Tracks" ,
520
- "Group albums" ,
521
- "Enter search" ,
522
- "enter Id" ,
523
- "aBort" ,
524
- ) + ("Foo" ,)
529
+ "Apply" ,
530
+ "More candidates" ,
531
+ "Skip" ,
532
+ "Use as-is" ,
533
+ "as Tracks" ,
534
+ "Group albums" ,
535
+ "Enter search" ,
536
+ "enter Id" ,
537
+ "aBort" ,
538
+ ) + ("Foo" ,)
525
539
526
540
# DummyPlugin.foo() should be called once
527
541
with helper .control_stdin ("f\n " ):
0 commit comments