当前位置: 首页>>代码示例>>Python>>正文


Python tools.assert_multi_line_equal函数代码示例

本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的nose.tools.assert_multi_line_equal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。