Skip to content

Commit a7ad94e

Browse files
committed
fix test and output
1 parent b143a40 commit a7ad94e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

datascience/util.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,9 @@ def wrapper(args):
136136
return f(*args)
137137

138138
result = optimize.minimize(wrapper, start, **vargs)
139-
return np.round(result.x, 7)
139+
rounded = np.round(result.x, 7)
140+
if len(start) == 1:
141+
return rounded.item(0)
142+
else:
143+
return rounded
140144

tests/test_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ def test_table_apply():
4242
assert all(newtab['b'] == tab['b'] + 1)
4343

4444
def test_minimize():
45-
assert 2 == ds.minimize(lambda x: (x-2)**2)
45+
assert (2 == ds.minimize(lambda x: (x-2)**2)) == True
4646
assert [2, 1] == list(ds.minimize(lambda x, y: (x-2)**2 + (y-1)**2))

0 commit comments

Comments
 (0)