File tree 3 files changed +26
-8
lines changed
midi_app_controller/models
3 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,19 @@ def test_valid_binds(binds_data):
59
59
},
60
60
],
61
61
),
62
+ ],
63
+ )
64
+ def test_binds_duplicate_id (binds_data , button_binds , knob_binds ):
65
+ binds_data ["button_binds" ] = button_binds
66
+ binds_data ["knob_binds" ] = knob_binds
67
+
68
+ with pytest .raises (ValidationError ):
69
+ Binds (** binds_data )
70
+
71
+
72
+ @pytest .mark .parametrize (
73
+ "button_binds, knob_binds" ,
74
+ [
62
75
(
63
76
[{"button_id" : 1 , "action_id" : "Action1" }],
64
77
[
@@ -71,12 +84,10 @@ def test_valid_binds(binds_data):
71
84
),
72
85
],
73
86
)
74
- def test_binds_duplicate_id (binds_data , button_binds , knob_binds ):
87
+ def test_allow_knob_button_collision (binds_data , button_binds , knob_binds ):
75
88
binds_data ["button_binds" ] = button_binds
76
89
binds_data ["knob_binds" ] = knob_binds
77
-
78
- with pytest .raises (ValidationError ):
79
- Binds (** binds_data )
90
+ Binds (** binds_data )
80
91
81
92
82
93
@pytest .mark .parametrize ("id" , [- 1 , 128 ])
Original file line number Diff line number Diff line change @@ -69,8 +69,14 @@ def check_duplicate_ids(cls, values):
69
69
button_ids = [bind .button_id for bind in values .button_binds ]
70
70
knob_ids = [bind .knob_id for bind in values .knob_binds ]
71
71
72
- duplicate = find_duplicate (button_ids + knob_ids )
73
- if duplicate is not None :
74
- raise ValueError (f"id={ duplicate } was bound to multiple actions" )
72
+ duplicate_buttons = find_duplicate (button_ids )
73
+ if duplicate_buttons is not None :
74
+ raise ValueError (
75
+ f"button id={ duplicate_buttons } was bound to multiple actions"
76
+ )
77
+
78
+ duplicate_knobs = find_duplicate (knob_ids )
79
+ if duplicate_knobs is not None :
80
+ raise ValueError (f"knob id={ duplicate_knobs } was bound to multiple actions" )
75
81
76
82
return values
Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ midi-app-controller = "midi_app_controller:napari.yaml"
35
35
testing = [
36
36
" pytest>=8.2.0" ,
37
37
" pytest-cov>=5.0.0" ,
38
- " pytest-qt>=4.0.2"
38
+ " pytest-qt>=4.0.2" ,
39
+ " flexparser!=0.4.0" # see https://napari.zulipchat.com/#narrow/channel/212875-general/topic/broken.20pint.2Fflexparser/near/481110284
39
40
]
40
41
dev = [
41
42
" midi-app-controller[testing]" ,
You can’t perform that action at this time.
0 commit comments