提交 075c53bd authored 作者: David Warde-Farley's avatar David Warde-Farley

Change auxillary functions from _tests to _checks so as not to trigger nose.

上级 2ed88a6d
...@@ -855,7 +855,7 @@ def rand_of_dtype(shape, dtype): ...@@ -855,7 +855,7 @@ def rand_of_dtype(shape, dtype):
else: else:
raise TypeError() raise TypeError()
def multi_dtype_tests(shape1, shape2, dtypes=ALL_DTYPES, nameprefix=''): def multi_dtype_checks(shape1, shape2, dtypes=ALL_DTYPES, nameprefix=''):
for dtype1, dtype2 in combinations(dtypes, 2): for dtype1, dtype2 in combinations(dtypes, 2):
name1 = '%s_%s_%s' % (nameprefix, dtype1, dtype2) name1 = '%s_%s_%s' % (nameprefix, dtype1, dtype2)
name2 = '%s_%s_%s' % (nameprefix, dtype2, dtype1) name2 = '%s_%s_%s' % (nameprefix, dtype2, dtype1)
...@@ -864,7 +864,7 @@ def multi_dtype_tests(shape1, shape2, dtypes=ALL_DTYPES, nameprefix=''): ...@@ -864,7 +864,7 @@ def multi_dtype_tests(shape1, shape2, dtypes=ALL_DTYPES, nameprefix=''):
yield (name1, (obj1, obj2)) yield (name1, (obj1, obj2))
yield (name2, (obj2, obj1)) yield (name2, (obj2, obj1))
def multi_dtype_cast_tests(shape, dtypes=ALL_DTYPES, nameprefix=''): def multi_dtype_cast_checks(shape, dtypes=ALL_DTYPES, nameprefix=''):
for dtype1, dtype2 in combinations(dtypes, 2): for dtype1, dtype2 in combinations(dtypes, 2):
name1 = '%s_%s_%s' % (nameprefix, dtype1, dtype2) name1 = '%s_%s_%s' % (nameprefix, dtype1, dtype2)
name2 = '%s_%s_%s' % (nameprefix, dtype2, dtype1) name2 = '%s_%s_%s' % (nameprefix, dtype2, dtype1)
...@@ -878,9 +878,9 @@ SecondBroadcastTester = makeTester( ...@@ -878,9 +878,9 @@ SecondBroadcastTester = makeTester(
op=second, op=second,
expected=_numpy_second, expected=_numpy_second,
good=dict(itertools.chain( good=dict(itertools.chain(
multi_dtype_tests((4, 5), (5,)), multi_dtype_checks((4, 5), (5,)),
multi_dtype_tests((2, 3, 2), (3, 2)), multi_dtype_checks((2, 3, 2), (3, 2)),
multi_dtype_tests((2, 3, 2), (2,)), multi_dtype_checks((2, 3, 2), (2,)),
)), )),
# I can't think of any way to make this fail at # I can't think of any way to make this fail at
# build time # build time
...@@ -898,12 +898,14 @@ SecondSameRankTester = makeTester( ...@@ -898,12 +898,14 @@ SecondSameRankTester = makeTester(
op=second, op=second,
expected=_numpy_second, expected=_numpy_second,
good=dict(itertools.chain( good=dict(itertools.chain(
multi_dtype_tests((4, 5), (4, 5)), multi_dtype_checks((4, 5), (4, 5)),
multi_dtype_tests((5, 4), (4, 5)), multi_dtype_checks((1, 2), (3, 2)),
multi_dtype_tests((1, 4), (3, 2)), multi_dtype_checks((3, 2), (1, 2)),
)), )),
bad_build=None, bad_runtime=dict(itertools.chain(
bad_runtime=None multi_dtype_checks((4, 5), (5, 4)),
multi_dtype_checks((1, 5), (5, 4)),
))
) )
CastTester = makeTester( CastTester = makeTester(
...@@ -911,8 +913,9 @@ CastTester = makeTester( ...@@ -911,8 +913,9 @@ CastTester = makeTester(
op=cast, op=cast,
expected=lambda x, y: x.astype(y), expected=lambda x, y: x.astype(y),
good=dict(itertools.chain( good=dict(itertools.chain(
multi_dtype_cast_tests((2,)), multi_dtype_cast_checks((2,)),
[('%s_%s' % (dtype, dtype), # Casts from foo to foo
[('%s_%s' % (rand_of_dtype((2,), dtype), dtype),
(rand_of_dtype((2,), dtype), dtype)) (rand_of_dtype((2,), dtype), dtype))
for dtype in ALL_DTYPES] for dtype in ALL_DTYPES]
)), )),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论