1313from typing_extensions import override
1414
1515from array_api_extra import (
16+ angle ,
1617 apply_where ,
1718 argpartition ,
1819 at ,
3334 setdiff1d ,
3435 sinc ,
3536 union1d ,
36- angle ,
3737)
3838from array_api_extra import (
3939 searchsorted as xpx_searchsorted ,
@@ -1883,10 +1883,11 @@ def test_device(self, xp: ModuleType, device: Device):
18831883 b = xp .asarray ([2 , - 2 , 0 ], device = device )
18841884 assert get_device (union1d (a , b )) == device
18851885
1886+
18861887class TestAngle :
18871888 def test_simple (self , xp : ModuleType ):
18881889 a = xp .asarray ([1 , 0 ])
1889- expected = xp .asarray ([0. , 0. ] )
1890+ expected = xp .asarray ([0.0 , 0.0 ], dtype = xp . float64 )
18901891 res = angle (a )
18911892 xp_assert_equal (res , expected )
18921893
@@ -1898,11 +1899,13 @@ def test_complex(self, xp: ModuleType):
18981899
18991900 def test_2d (self , xp : ModuleType ):
19001901 a = xp .asarray ([[1 + 1j , 1 - 1j ], [- 1 + 1j , - 1 - 1j ]])
1901- expected = xp .asarray ([[np .pi / 4 , - np .pi / 4 ], [3 * np .pi / 4 , - 3 * np .pi / 4 ]])
1902+ expected = xp .asarray (
1903+ [[np .pi / 4 , - np .pi / 4 ], [3 * np .pi / 4 , - 3 * np .pi / 4 ]]
1904+ )
19021905 res = angle (a )
19031906 xp_assert_equal (res , expected )
19041907
19051908 @pytest .mark .skip_xp_backend (Backend .TORCH , reason = "materialize 'meta' device" )
19061909 def test_device (self , xp : ModuleType , device : Device ):
19071910 a = xp .asarray ([1 + 1j ], device = device )
1908- assert get_device (angle (a )) == device
1911+ assert get_device (angle (a )) == device
0 commit comments