11from __future__ import division , absolute_import , print_function
22
33from numpy .testing import *
4- from numpy import logspace , linspace , dtype
5-
4+ from numpy import logspace , linspace , dtype , array
65
76class TestLogspace (TestCase ):
87
@@ -55,3 +54,25 @@ def test_dtype(self):
5554 assert_equal (y .dtype , dtype ('float64' ))
5655 y = linspace (0 , 6 , dtype = 'int32' )
5756 assert_equal (y .dtype , dtype ('int32' ))
57+
58+ def test_array_scalar (self ):
59+ lim1 = array ([- 120 , 100 ], dtype = "int8" )
60+ lim2 = array ([120 , - 100 ], dtype = "int8" )
61+ lim3 = array ([1200 , 1000 ], dtype = "uint16" )
62+ t1 = linspace (lim1 [0 ], lim1 [1 ], 5 )
63+ t2 = linspace (lim2 [0 ], lim2 [1 ], 5 )
64+ t3 = linspace (lim3 [0 ], lim3 [1 ], 5 )
65+ t4 = linspace (- 120.0 , 100.0 , 5 )
66+ t5 = linspace (120.0 , - 100.0 , 5 )
67+ t6 = linspace (1200.0 , 1000.0 , 5 )
68+ assert_equal (t1 , t4 )
69+ assert_equal (t2 , t5 )
70+ assert_equal (t3 , t6 )
71+
72+ def test_complex (self ):
73+ lim1 = linspace (1 + 2j , 3 + 4j , 5 )
74+ t1 = array ([ 1.0 + 2.j , 1.5 + 2.5j , 2.0 + 3.j , 2.5 + 3.5j , 3.0 + 4.j ])
75+ lim2 = linspace (1j , 10 , 5 )
76+ t2 = array ([ 0.0 + 1.j , 2.5 + 0.75j , 5.0 + 0.5j , 7.5 + 0.25j , 10.0 + 0.j ])
77+ assert_equal (lim1 , t1 )
78+ assert_equal (lim2 , t2 )
0 commit comments