MCPcopy
hub / github.com/numpy/numpy / test_basic

Method test_basic

numpy/_core/tests/test_function_base.py:148–168  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

146class TestGeomspace:
147
148 def test_basic(self):
149 y = geomspace(1, 1e6)
150 assert_(len(y) == 50)
151 y = geomspace(1, 1e6, num=100)
152 assert_(y[-1] == 10 ** 6)
153 y = geomspace(1, 1e6, endpoint=False)
154 assert_(y[-1] < 10 ** 6)
155 y = geomspace(1, 1e6, num=7)
156 assert_array_equal(y, [1, 10, 100, 1e3, 1e4, 1e5, 1e6])
157
158 y = geomspace(8, 2, num=3)
159 assert_allclose(y, [8, 4, 2])
160 assert_array_equal(y.imag, 0)
161
162 y = geomspace(-1, -100, num=3)
163 assert_array_equal(y, [-1, -10, -100])
164 assert_array_equal(y.imag, 0)
165
166 y = geomspace(-100, -1, num=3)
167 assert_array_equal(y, [-100, -10, -1])
168 assert_array_equal(y.imag, 0)
169
170 def test_boundaries_match_start_and_stop_exactly(self):
171 # make sure that the boundaries of the returned array exactly

Callers

nothing calls this directly

Calls 4

geomspaceFunction · 0.90
assert_Function · 0.90
assert_array_equalFunction · 0.90
assert_allcloseFunction · 0.90

Tested by

no test coverage detected