本文整理汇总了Python中nose.tools.assert_multi_line_equal函数的典型用法代码示例。如果您正苦于以下问题:Python assert_multi_line_equal函数的具体用法?Python assert_multi_line_equal怎么用?Python assert_multi_line_equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_multi_line_equal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _test_good
def _test_good(self, filename):
base_name, _ = os.path.splitext(filename)
input_filename = base_name + '.input'
if not os.path.exists(input_filename):
input_filename = os.devnull
output_filename = base_name + '.output'
rc, stderr = self._compile(filename)
stderr = stderr.decode()
assert_multi_line_equal(stderr, '')
assert_equal(rc, 0)
with open(input_filename, 'rb') as input_file:
child = ipc.Popen(self.runner + [self.executable],
stdin=input_file,
stdout=ipc.PIPE,
stderr=ipc.PIPE
)
stdout = child.stdout.read()
stderr = child.stderr.read()
rc = child.wait()
stderr = stderr.decode()
assert_multi_line_equal(stderr, '')
assert_equal(rc, 0)
with open(output_filename, 'rb') as output_file:
expected_stdout = output_file.read()
assert_equal(expected_stdout, stdout)
开发者ID:jwilk,项目名称:jtc,代码行数:25,代码来源:test_examples.py
示例2: test_convert_to_docstring
def test_convert_to_docstring():
assert_equal(convert_to_docstring(None), "")
assert_multi_line_equal(
convert_to_docstring(lines(
"/**",
" * This is a brief comment.",
" */")),
"This is a brief comment."
)
assert_multi_line_equal(
convert_to_docstring("/// This is a brief comment."),
"This is a brief comment."
)
assert_multi_line_equal(
convert_to_docstring(lines(
"/**",
" * This is a brief comment.",
" *",
" * This is a detailed comment.",
" */")
),
lines(
"This is a brief comment.",
"",
"This is a detailed comment.")
)
assert_multi_line_equal(
convert_to_docstring(lines(
"/**",
" * This is a brief comment.",
" * This is a detailed comment.",
" */")
),
lines(
"This is a brief comment.",
"",
"This is a detailed comment.")
)
assert_multi_line_equal(
convert_to_docstring(lines(
"/**",
" * This is a brief comment.",
" * ",
" * This is a detailed comment.",
" * It contains mathematical equations, like 2 * 3 + 5 = 11.",
" * It is important that it includes '*'. 5x * 3x*y = y*z!"
" */")
),
lines(
"This is a brief comment.",
"",
"This is a detailed comment.",
"It contains mathematical equations, like 2 * 3 + 5 = 11.",
"It is important that it includes '*'. 5x * 3x*y = y*z!")
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:60,代码来源:test_utils.py
示例3: test_semanticizer_nlwiki
def test_semanticizer_nlwiki():
tempfile = NamedTemporaryFile()
db = create_model(join(dirname(__file__),
'nlwiki-20140927-pages-articles-sample.xml'),
tempfile.name)
sem = Semanticizer(tempfile.name)
dirs = {d: join(dirname(__file__), 'nlwiki', d)
for d in "in expected actual".split()}
input_test_cases = glob(join(dirs['in'], '*'))
assert_equal(len(input_test_cases), 20,
msg=("number of input test cases in %r should be 20"
% dirs['in']))
for doc in input_test_cases:
fname = basename(doc)
with open(doc) as f:
with open(join(dirs['actual'], fname), 'w') as out:
tokens = f.read().split()
out.write("\n".join(str(cand)
for cand in sem.all_candidates(tokens)))
with open(join(dirs['expected'], fname)) as f:
expected = f.read()
with open(join(dirs['actual'], fname)) as f:
actual = f.read()
assert_multi_line_equal(expected,
actual)
开发者ID:Los-Phoenix,项目名称:semanticizest,代码行数:29,代码来源:test_semanticizer.py
示例4: _test
def _test(format):
pandoc_output = call_pandoc(format)
ref_file = 'tests/spec.{ext}'.format(ext=format)
with open(ref_file) as f:
nt.assert_multi_line_equal(pandoc_output, f.read())
开发者ID:ivotron,项目名称:pandoc-reference-filter,代码行数:7,代码来源:tests.py
示例5: test_function_string_with_return
def test_function_string_with_return():
f = Function("test.hpp", "", "my_fun", "double")
assert_multi_line_equal(
str(f), lines(
"Function 'my_fun'",
" Returns (double)"
)
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:8,代码来源:test_ast.py
示例6: test_notedown
def test_notedown():
"""Integration test the whole thing."""
from difflib import ndiff
notebook = create_json_notebook(sample_markdown)
diff = ndiff(sample_notebook.splitlines(1), notebook.splitlines(1))
print '\n'.join(diff)
nt.assert_multi_line_equal(create_json_notebook(sample_markdown),
sample_notebook)
开发者ID:orianna14,项目名称:notedown,代码行数:8,代码来源:tests.py
示例7: test_make_header
def test_make_header():
assert_multi_line_equal(
make_header("a b c d"),
lines(
"+" + "=" * 78 + "+",
"| a b c d" + " " * 70 + "|",
"+" + "=" * 78 + "+"
)
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:9,代码来源:test_utils.py
示例8: test_template_class_string
def test_template_class_string():
c = TemplateClass("test.hpp", "", "MyTemplateClass")
c.template_types.append("T")
assert_multi_line_equal(
str(c), lines(
"TemplateClass 'MyTemplateClass' ('MyTemplateClass')",
" Template type 'T'"
)
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:9,代码来源:test_ast.py
示例9: test_write_table2
def test_write_table2(self):
import os
TestObsTable.obstable.add_records_to_table([TestObsTable.obsrecord,TestObsTable.obsrecord])
TestObsTable.obstable.filename = 'testtable2.dat'
TestObsTable.obstable.write_table()
expected_result = open(TestObsTable.filename, 'r').read()
result = open('testtable2.dat', 'r').read()
os.remove('testtable2.dat')
assert_multi_line_equal(result, expected_result)
开发者ID:Clarf,项目名称:reduxF2LS-BELR,代码行数:9,代码来源:test_obstable.py
示例10: test_simple_function_def
def test_simple_function_def():
method = MethodDefinition(
"Testclass", "", "testfun", [], Includes(),
"void", TypeInfo({}), Config()).make()
assert_multi_line_equal(
method,
lines("cpdef testfun(Testclass self):",
" self.thisptr.testfun()")
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:9,代码来源:test_exporter.py
示例11: _test_bad
def _test_bad(self, filename):
base_name, _ = os.path.splitext(filename)
error_filename = base_name + '.error'
rc, stderr = self._compile(filename, output_filename=os.devnull)
stderr = stderr.decode()
assert_not_equal(rc, 0)
with open(error_filename, 'r') as error_file:
expected_stderr = error_file.read()
assert_multi_line_equal(expected_stderr, stderr)
开发者ID:jwilk,项目名称:jtc,代码行数:9,代码来源:test_examples.py
示例12: test_array_arg_function_def
def test_array_arg_function_def():
method = MethodDefinition(
"Testclass", "", "testfun", [Param("a", "double *"),
Param("aSize", "unsigned int")],
Includes(), "void", TypeInfo({}), Config()).make()
assert_multi_line_equal(
method,
lines("cpdef testfun(Testclass self, np.ndarray[double, ndim=1] a):",
" self.thisptr.testfun(&a[0], a.shape[0])")
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:10,代码来源:test_exporter.py
示例13: test_default_ctor_def
def test_default_ctor_def():
ctor = ConstructorDefinition("MyClass", "", [], Includes(), TypeInfo(),
Config(), "MyClass").make()
assert_multi_line_equal(
ctor,
lines(
"def __init__(MyClass self):",
" self.thisptr = new cpp.MyClass()"
)
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:10,代码来源:test_exporter.py
示例14: test_function_def_with_another_cppname
def test_function_def_with_another_cppname():
fun = FunctionDefinition("myFunInt", "", [], Includes(), "void", TypeInfo(),
Config(), cppname="myFun").make()
assert_multi_line_equal(
fun,
lines(
"cpdef my_fun_int():",
" cpp.myFun()"
)
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:10,代码来源:test_exporter.py
示例15: test_function_def
def test_function_def():
fun = FunctionDefinition("myFun", "", [], Includes(), "void", TypeInfo(),
Config()).make()
assert_multi_line_equal(
fun,
lines(
"cpdef my_fun():",
" cpp.myFun()"
)
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:10,代码来源:test_exporter.py
示例16: _test_text
def _test_text(ipath, xpath):
assert xpath.endswith('.exp')
if '@' in xpath:
language = xpath[:-4].rsplit('@')[1]
else:
language = 'en-US'
text = _get_output(ipath, language)
with open(xpath, 'rt', encoding='utf-8') as file:
expected = file.read()
assert_multi_line_equal(text, expected)
开发者ID:dwaynebailey,项目名称:mwic,代码行数:10,代码来源:test_blackbox.py
示例17: test_template_function_string
def test_template_function_string():
m = TemplateFunction("test.hpp", "", "my_template_fun", "void")
m.nodes.append(Param("t", "T"))
m.template_types.append("T")
assert_multi_line_equal(
str(m), lines(
"TemplateFunction 'my_template_fun'",
" Parameter (T) t",
" Template type 'T'"
)
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:11,代码来源:test_ast.py
示例18: test_template_method_string
def test_template_method_string():
m = TemplateMethod("my_template_method", "void", "MyClass")
m.nodes.append(Param("t", "T"))
m.template_types.append("T")
assert_multi_line_equal(
str(m), lines(
"TemplateMethod 'my_template_method'",
" Parameter (T) t",
" Template type 'T'"
)
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:11,代码来源:test_ast.py
示例19: test_comments
def test_comments():
with cython_extension_from("comments.hpp"):
from comments import MyClass, MyEnum
assert_multi_line_equal(
lines("This is a brief class description.",
" ",
" And this is a detailed description.",
" "),
MyClass.__doc__)
assert_equal("Brief.", MyClass.method.__doc__.strip())
assert_equal("Brief description of enum.", MyEnum.__doc__.strip())
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:11,代码来源:test_comments.py
示例20: test_setter_definition
def test_setter_definition():
field = Field("myField", "double", "MyClass")
setter = SetterDefinition(
"MyClass", field, Includes(), TypeInfo(), Config()).make()
assert_multi_line_equal(
setter,
lines(
"cpdef set_my_field(MyClass self, double myField):",
" cdef double cpp_myField = myField",
" self.thisptr.myField = cpp_myField"
)
)
开发者ID:AlexanderFabisch,项目名称:cythonwrapper,代码行数:12,代码来源:test_exporter.py
注:本文中的nose.tools.assert_multi_line_equal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论