@@ -24,7 +24,7 @@ def test_no_matching_arg_count(device_type: DeviceType):
2424    device  =  helpers .get_device (device_type )
2525    function  =  helpers .create_function_from_module (device , "foo" , MODULE )
2626
27-     with  pytest .raises (ValueError , match = r'Too many positional arguments' ):
27+     with  pytest .raises (Exception , match = r'Too many positional arguments' ):
2828        function .call (1.0 , 2.0 )
2929
3030
@@ -34,7 +34,7 @@ def test_no_matching_arg_name(device_type: DeviceType):
3434    device  =  helpers .get_device (device_type )
3535    function  =  helpers .create_function_from_module (device , "foo" , MODULE )
3636
37-     with  pytest .raises (ValueError , match = r'No parameter named' ):
37+     with  pytest .raises (Exception , match = r'No parameter named' ):
3838        function .call (b = 10.0 )
3939
4040
@@ -46,7 +46,7 @@ def test_not_enough_args(device_type: DeviceType):
4646
4747    # note: due to no implicit args, falls straight through to slang resolution which provides 
4848    # no special error info yet 
49-     with  pytest .raises (ValueError , match = r'No Slang overload found' ):
49+     with  pytest .raises (Exception , match = r'No Slang overload found' ):
5050        function .call ()
5151
5252
@@ -56,7 +56,7 @@ def test_not_enough_args_2(device_type: DeviceType):
5656    device  =  helpers .get_device (device_type )
5757    function  =  helpers .create_function_from_module (device , "foo2" , MODULE )
5858
59-     with  pytest .raises (ValueError , match = r'all parameters must be specified' ):
59+     with  pytest .raises (Exception , match = r'all parameters must be specified' ):
6060        function .call (10.0 )
6161
6262
@@ -66,7 +66,7 @@ def test_specify_twice(device_type: DeviceType):
6666    device  =  helpers .get_device (device_type )
6767    function  =  helpers .create_function_from_module (device , "foo2" , MODULE )
6868
69-     with  pytest .raises (ValueError , match = r'already specified' ):
69+     with  pytest .raises (Exception , match = r'already specified' ):
7070        function .call (10.0 , a = 20.0 )
7171
7272
@@ -76,7 +76,7 @@ def test_implicit_overload(device_type: DeviceType):
7676    device  =  helpers .get_device (device_type )
7777    function  =  helpers .create_function_from_module (device , "foo_ol" , MODULE )
7878
79-     with  pytest .raises (ValueError , match = r'overloaded function with named or implicit arguments' ):
79+     with  pytest .raises (Exception , match = r'overloaded function with named or implicit arguments' ):
8080        function .call (10.0 )
8181
8282
@@ -129,5 +129,19 @@ def test_invalid_broadcast(device_type: DeviceType):
129129        function (buffer , buffer2 )
130130
131131
132+ @pytest .mark .parametrize ("device_type" , helpers .DEFAULT_DEVICE_TYPES ) 
133+ def  test_invalid_broadcast_during_dispatch (device_type : DeviceType ):
134+ 
135+     device  =  helpers .get_device (device_type )
136+     function  =  helpers .create_function_from_module (device , "foo2" , MODULE )
137+ 
138+     buffer  =  NDBuffer (device , dtype = float , shape = (10 , 5 ))
139+     buffer2  =  NDBuffer (device , dtype = float , shape = (10 , 10 ))
140+ 
141+     # fail to specialize a float3 against a float 
142+     with  pytest .raises (ValueError , match = r'Shape mismatch' ):
143+         function (buffer , buffer2 )
144+ 
145+ 
132146if  __name__  ==  "__main__" :
133147    pytest .main ([__file__ , "-v" ])
0 commit comments