本文整理汇总了Python中nose.plugins.skip.SkipTest方法的典型用法代码示例。如果您正苦于以下问题:Python skip.SkipTest方法的具体用法?Python skip.SkipTest怎么用?Python skip.SkipTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nose.plugins.skip
的用法示例。
在下文中一共展示了skip.SkipTest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_format_docstrings
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_format_docstrings():
"""
Test if docstrings are well formatted.
"""
# Disabled for now
return True
try:
verify_format_docstrings()
except SkipTest as e:
import traceback
traceback.print_exc(e)
raise AssertionError(
"Some file raised SkipTest on import, and inadvertently"
" canceled the documentation testing."
)
示例2: verify_format_docstrings
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def verify_format_docstrings():
"""
Implementation of `test_format_docstrings`. The implementation is
factored out so it can be placed inside a guard against SkipTest.
"""
format_infractions = []
for path in list_files(".py"):
rel_path = os.path.relpath(path, cleverhans.__path__[0])
if rel_path in whitelist_docstrings:
continue
try:
format_infractions.extend(docstring_errors(path))
except Exception as e:
format_infractions.append(["%s failed to run so format cannot "
"be checked. Error message:\n %s" %
(rel_path, e)])
if len(format_infractions) > 0:
msg = "\n".join(':'.join(line) for line in format_infractions)
raise AssertionError("Docstring format not respected:\n%s" % msg)
示例3: test_course_credits_inst_200_ok
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_course_credits_inst_200_ok(self):
raise SkipTest()
client = Client()
client.login_user("ggbaker")
url = reverse('planning.views.view_teaching_credits_inst')
response = basic_page_tests(self, client, url)
self.assertEqual(response.status_code, 200)
url = reverse('planning.views.view_teaching_equivalent_inst', kwargs={'equivalent_id': 1})
response = basic_page_tests(self, client, url)
self.assertEqual(response.status_code, 200)
url = reverse('planning.views.new_teaching_equivalent_inst')
response = basic_page_tests(self, client, url)
self.assertEqual(response.status_code, 200)
url = reverse('planning.views.edit_teaching_equivalent_inst', kwargs={'equivalent_id': 1})
response = basic_page_tests(self, client, url)
self.assertEqual(response.status_code, 200)
示例4: test_local_csm_grad_c
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_local_csm_grad_c():
raise SkipTest("Opt disabled as it don't support unsorted indices")
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
data = tensor.vector()
indices, indptr, shape = (tensor.ivector(), tensor.ivector(),
tensor.ivector())
mode = theano.compile.mode.get_default_mode()
if theano.config.mode == 'FAST_COMPILE':
mode = theano.compile.Mode(linker='c|py', optimizer='fast_compile')
mode = mode.including("specialize", "local_csm_grad_c")
for CS, cast in [(sparse.CSC, sp.csc_matrix), (sparse.CSR, sp.csr_matrix)]:
cost = tensor.sum(sparse.DenseFromSparse()(CS(data, indices, indptr, shape)))
f = theano.function(
[data, indices, indptr, shape],
tensor.grad(cost, data),
mode=mode)
assert not any(isinstance(node.op, sparse.CSMGrad) for node
in f.maker.fgraph.toposort())
v = cast(random_lil((10, 40),
config.floatX, 3))
f(v.data, v.indices, v.indptr, v.shape)
示例5: test_local_mul_s_d
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_local_mul_s_d():
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
mode = theano.compile.mode.get_default_mode()
mode = mode.including("specialize", "local_mul_s_d")
for sp_format in sparse.sparse_formats:
inputs = [getattr(theano.sparse, sp_format + '_matrix')(),
tensor.matrix()]
f = theano.function(inputs,
sparse.mul_s_d(*inputs),
mode=mode)
assert not any(isinstance(node.op, sparse.MulSD) for node
in f.maker.fgraph.toposort())
示例6: test_local_mul_s_v
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_local_mul_s_v():
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
mode = theano.compile.mode.get_default_mode()
mode = mode.including("specialize", "local_mul_s_v")
for sp_format in ['csr']: # Not implemented for other format
inputs = [getattr(theano.sparse, sp_format + '_matrix')(),
tensor.vector()]
f = theano.function(inputs,
sparse.mul_s_v(*inputs),
mode=mode)
assert not any(isinstance(node.op, sparse.MulSV) for node
in f.maker.fgraph.toposort())
示例7: test_local_structured_add_s_v
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_local_structured_add_s_v():
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
mode = theano.compile.mode.get_default_mode()
mode = mode.including("specialize", "local_structured_add_s_v")
for sp_format in ['csr']: # Not implemented for other format
inputs = [getattr(theano.sparse, sp_format + '_matrix')(),
tensor.vector()]
f = theano.function(inputs,
sparse.structured_add_s_v(*inputs),
mode=mode)
assert not any(isinstance(node.op, sparse.StructuredAddSV) for node
in f.maker.fgraph.toposort())
示例8: test_local_sampling_dot_csr
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_local_sampling_dot_csr():
if not theano.config.cxx:
raise SkipTest("G++ not available, so we need to skip this test.")
mode = theano.compile.mode.get_default_mode()
mode = mode.including("specialize", "local_sampling_dot_csr")
for sp_format in ['csr']: # Not implemented for other format
inputs = [tensor.matrix(),
tensor.matrix(),
getattr(theano.sparse, sp_format + '_matrix')()]
f = theano.function(inputs,
sparse.sampling_dot(*inputs),
mode=mode)
if theano.config.blas.ldflags:
assert not any(isinstance(node.op, sparse.SamplingDot) for node
in f.maker.fgraph.toposort())
else:
# SamplingDotCSR's C implementation needs blas, so it should not
# be inserted
assert not any(isinstance(node.op, sparse.opt.SamplingDotCSR) for node
in f.maker.fgraph.toposort())
示例9: __generalized_ss_test
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def __generalized_ss_test(self, theanop, symbolicType, testOp, scipyType):
scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 13])):
raise SkipTest("comparison operators need newer release of scipy")
x = symbolicType()
y = symbolicType()
op = theanop(x, y)
f = theano.function([x, y], op)
m1 = scipyType(random_lil((10, 40), config.floatX, 3))
m2 = scipyType(random_lil((10, 40), config.floatX, 3))
self.assertTrue(numpy.array_equal(f(m1, m2).data, testOp(m1, m2).data))
示例10: __generalized_sd_test
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def __generalized_sd_test(self, theanop, symbolicType, testOp, scipyType):
scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 13])):
raise SkipTest("comparison operators need newer release of scipy")
x = symbolicType()
y = theano.tensor.matrix()
op = theanop(x, y)
f = theano.function([x, y], op)
m1 = scipyType(random_lil((10, 40), config.floatX, 3))
m2 = self._rand_ranged(1000, -1000, [10, 40])
self.assertTrue(numpy.array_equal(f(m1, m2).data, testOp(m1, m2).data))
示例11: __generalized_ds_test
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def __generalized_ds_test(self, theanop, symbolicType, testOp, scipyType):
scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 13])):
raise SkipTest("comparison operators need newer release of scipy")
x = symbolicType()
y = theano.tensor.matrix()
op = theanop(y, x)
f = theano.function([y, x], op)
m1 = scipyType(random_lil((10, 40), config.floatX, 3))
m2 = self._rand_ranged(1000, -1000, [10, 40])
self.assertTrue(numpy.array_equal(f(m2, m1).data, testOp(m2, m1).data))
示例12: test_equality_case
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_equality_case(self):
"""
Test assuring normal behaviour when values
in the matrices are equal
"""
scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 13])):
raise SkipTest("comparison operators need newer release of scipy")
x = sparse.csc_matrix()
y = theano.tensor.matrix()
m1 = sp.csc_matrix((2, 2), dtype=theano.config.floatX)
m2 = numpy.asarray([[0, 0], [0, 0]], dtype=theano.config.floatX)
for func in self.testsDic:
op = func(y, x)
f = theano.function([y, x], op)
self.assertTrue(numpy.array_equal(f(m2, m1),
self.testsDic[func](m2, m1)))
示例13: test_grad
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_grad(self):
c = T.matrix()
p_y = T.exp(c) / T.exp(c).sum(axis=1).dimshuffle(0, 'x')
# test that function contains softmax and softmaxgrad
w = T.matrix()
backup = config.warn.sum_div_dimshuffle_bug
config.warn.sum_div_dimshuffle_bug = False
try:
g = theano.function([c, w], T.grad((p_y * w).sum(), c))
hasattr(g.maker.fgraph.outputs[0].tag, 'trace')
finally:
config.warn.sum_div_dimshuffle_bug = backup
g_ops = [n.op for n in g.maker.fgraph.toposort()]
# print '--- g ='
# printing.debugprint(g)
# print '==='
raise SkipTest('Optimization not enabled for the moment')
assert len(g_ops) == 2
assert softmax_op in g_ops
assert softmax_grad in g_ops
g(self.rng.rand(3, 4), self.rng.uniform(.5, 1, (3, 4)))
示例14: test_transpose_basic
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_transpose_basic(self):
# this should be a transposed softmax
c = T.matrix()
p_y = T.exp(c) / T.exp(c).sum(axis=0)
# test that function contains softmax and no div.
f = theano.function([c], p_y)
# printing.debugprint(f)
# test that function contains softmax and no div.
backup = config.warn.sum_div_dimshuffle_bug
config.warn.sum_div_dimshuffle_bug = False
try:
g = theano.function([c], T.grad(p_y.sum(), c))
hasattr(g.maker.fgraph.outputs[0].tag, 'trace')
finally:
config.warn.sum_div_dimshuffle_bug = backup
# printing.debugprint(g)
raise SkipTest('Optimization not enabled for the moment')
示例15: test_1d_basic
# 需要导入模块: from nose.plugins import skip [as 别名]
# 或者: from nose.plugins.skip import SkipTest [as 别名]
def test_1d_basic(self):
# this should be a softmax, but of a one-row matrix
c = T.vector()
p_y = T.exp(c) / T.exp(c).sum()
# test that function contains softmax and no div.
f = theano.function([c], p_y)
hasattr(f.maker.fgraph.outputs[0].tag, 'trace')
# printing.debugprint(f)
# test that function contains softmax and no div.
backup = config.warn.sum_div_dimshuffle_bug
config.warn.sum_div_dimshuffle_bug = False
try:
g = theano.function([c], T.grad(p_y.sum(), c))
hasattr(g.maker.fgraph.outputs[0].tag, 'trace')
finally:
config.warn.sum_div_dimshuffle_bug = backup
# printing.debugprint(g)
raise SkipTest('Optimization not enabled for the moment')
# REPEAT 3 CASES in presence of log(softmax) with the advanced indexing
# etc.