本文整理汇总了Python中numba.unittest_support.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了main函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_string_eq
return "bar"
def test_string_eq(self):
@udf(BooleanVal(FunctionContext, StringVal))
def fn(context, a):
if a == "foo":
return True
elif a == "bar":
return False
else:
return None
def test_return_string_literal(self):
@udf(StringVal(FunctionContext, StringVal))
def fn(context, a):
return "foo"
def test_return_empty_string(self):
@udf(StringVal(FunctionContext, StringVal))
def fn(context, a):
return ""
def test_string_len(self):
@udf(IntVal(FunctionContext, StringVal))
def fn(context, a):
return len(a)
if __name__ == "__main__":
unittest.main(verbosity=2)
示例2: compile_isolated
cres = compile_isolated(pyfunc, [types.int16, types.int16])
cfunc = cres.entry_point
self.assertTrue(cfunc(1, 6), pyfunc(1, 6))
@tag('important')
def test_loop3_int32(self):
pyfunc = loop3
cres = compile_isolated(pyfunc, [types.int32] * 3)
cfunc = cres.entry_point
arglist = [
(1, 2, 1),
(2, 8, 3),
(-10, -11, -10),
(-10, -10, -2),
]
for args in arglist:
self.assertEqual(cfunc(*args), pyfunc(*args))
@tag('important')
@unittest.skipIf(sys.version_info >= (3,), "test is Python 2-specific")
def test_xrange(self):
pyfunc = xrange_usecase
cres = compile_isolated(pyfunc, (types.int32,))
cfunc = cres.entry_point
self.assertEqual(cfunc(5), pyfunc(5))
if __name__ == '__main__':
unittest.main()
示例3: cfunc
cfunc()
def test_unpack_tuple_too_small(self):
self.check_unpack_error(unpack_tuple_too_small)
def test_unpack_tuple_too_small_npm(self):
self.check_unpack_error(unpack_tuple_too_small, no_pyobj_flags)
def test_unpack_tuple_too_large(self):
self.check_unpack_error(unpack_tuple_too_large)
def test_unpack_tuple_too_large_npm(self):
self.check_unpack_error(unpack_tuple_too_large, no_pyobj_flags)
def test_unpack_range_too_small(self):
self.check_unpack_error(unpack_range_too_small)
def test_unpack_range_too_small_npm(self):
self.check_unpack_error(unpack_range_too_small, no_pyobj_flags)
def test_unpack_range_too_large(self):
self.check_unpack_error(unpack_range_too_large)
def test_unpack_range_too_large_npm(self):
self.check_unpack_error(unpack_range_too_large, no_pyobj_flags)
if __name__ == '__main__':
unittest.main(buffer=True)