MCPcopy Create free account
hub / github.com/numpy/numpy / test_basic

Method test_basic

numpy/core/tests/test_function_base.py:122–142  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

120class TestGeomspace:
121
122 def test_basic(self):
123 y = geomspace(1, 1e6)
124 assert_(len(y) == 50)
125 y = geomspace(1, 1e6, num=100)
126 assert_(y[-1] == 10 ** 6)
127 y = geomspace(1, 1e6, endpoint=False)
128 assert_(y[-1] < 10 ** 6)
129 y = geomspace(1, 1e6, num=7)
130 assert_array_equal(y, [1, 10, 100, 1e3, 1e4, 1e5, 1e6])
131
132 y = geomspace(8, 2, num=3)
133 assert_allclose(y, [8, 4, 2])
134 assert_array_equal(y.imag, 0)
135
136 y = geomspace(-1, -100, num=3)
137 assert_array_equal(y, [-1, -10, -100])
138 assert_array_equal(y.imag, 0)
139
140 y = geomspace(-100, -1, num=3)
141 assert_array_equal(y, [-100, -10, -1])
142 assert_array_equal(y.imag, 0)
143
144 def test_boundaries_match_start_and_stop_exactly(self):
145 # 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