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


Python assertions.assert_equal函数代码示例

本文整理汇总了Python中testify.assertions.assert_equal函数的典型用法代码示例。如果您正苦于以下问题:Python assert_equal函数的具体用法?Python assert_equal怎么用?Python assert_equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了assert_equal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_message_param_not_deprecated

    def test_message_param_not_deprecated(self):
        with warnings.catch_warnings(record=True) as w:
            assertions.assert_all_not_match_regex("qux",
                                                  ["foobar", "barbaz"],
                                                  message="This is a message")

            assertions.assert_equal(len(w), 0)
开发者ID:pyarnold,项目名称:Testify,代码行数:7,代码来源:assertions_test.py

示例2: test_deprecated_msg_param

    def test_deprecated_msg_param(self):
        with warnings.catch_warnings(record=True) as w:
            assertions.assert_is_not(False, None, msg="This is a message")

            assertions.assert_equal(len(w), 1)
            assert issubclass(w[-1].category, DeprecationWarning)
            assertions.assert_in("msg is deprecated", str(w[-1].message))
开发者ID:pyarnold,项目名称:Testify,代码行数:7,代码来源:assertions_test.py

示例3: test

 def test(self):
     super(SimpleTestCase, self).test()
     assert_equal(
         self.lines,
         ['first', '1', 'second', '2.0', 'third', 'asdf', 'fourth', 'ohai',
          'fifth', 'hommage à jack'
         ]
     )
开发者ID:Yelp,项目名称:ezio,代码行数:8,代码来源:coercion.py

示例4: test_build_reader

 def test_build_reader(self, mock_get_namespace):
     config_key, validator, namespace = 'the_key', mock.Mock(), 'the_name'
     reader = readers.build_reader(validator, namespace)
     value = reader(config_key)
     mock_get_namespace.assert_called_with(namespace)
     validator.assert_called_with(
         mock_get_namespace.return_value.get.return_value)
     assert_equal(value, validator.return_value)
开发者ID:analogue,项目名称:PyStaticConfiguration,代码行数:8,代码来源:readers_test.py

示例5: test

    def test(self):
        super(TestCase, self).test()

        expected_lines = ['self.bar %s' % (BAR_VALUE,),
                'self.counter 0',
                'self.bar still %s' % (BAR_VALUE,),
                'self.counter now 1',
                'asdf asdf']
        assert_equal(self.lines, expected_lines)
开发者ID:Yelp,项目名称:ezio,代码行数:9,代码来源:self_pointer.py

示例6: test

    def test(self):
        super(SubclassTestCase, self).test()

        assert_equal(self.lines,
                ['simple_subclass::first',
                 'simple_subclass::second',
                 # test that we dispatched correctly to the superclass method
                 'simple_superclass::second',
                ])
开发者ID:Yelp,项目名称:ezio,代码行数:9,代码来源:super_keyword.py

示例7: test_can_hash

    def test_can_hash(self):
        # Only immutable objects are hashable, and hashable objects can be dict keys.
        fd1 = fdict(a=1, b=2)
        fd2 = fdict({'a':1, 'b':2})

        mydict = {fd1:1}
        mydict[fd2] = 2

        T.assert_equal(mydict[fd1], 2)
开发者ID:bukzor,项目名称:scratch,代码行数:9,代码来源:frozendict_test.py

示例8: test_list_tests_json

    def test_list_tests_json(self):
        output = test_call([
            sys.executable, '-m', 'testify.test_program',
            '--list-tests', 'testing_suite',
            '--list-tests-format', 'json',
        ])
        assert_equal(output, '''\
{"suites": [], "test": "testing_suite.example_test ExampleTestCase.test_one"}
{"suites": [], "test": "testing_suite.example_test ExampleTestCase.test_two"}
{"suites": [], "test": "testing_suite.example_test SecondTestCase.test_one"}''')
开发者ID:Yelp,项目名称:Testify,代码行数:10,代码来源:test_program_test.py

示例9: test_client_returns_zero_on_success

 def test_client_returns_zero_on_success(self):
     server_process = subprocess.Popen(
         ["python", "-m", "testify.test_program", "testing_suite.example_test", "--serve", "9001"],
         stdout=open(os.devnull, "w"),
         stderr=open(os.devnull, "w"),
     )
     # test_call has the side-effect of asserting the return code is 0
     ret = test_call(["python", "-m", "testify.test_program", "--connect", "localhost:9001"])
     assert_in("PASSED", ret)
     assert_equal(server_process.wait(), 0)
开发者ID:bukzor,项目名称:Testify,代码行数:10,代码来源:test_program_test.py

示例10: test

    def test(self):
        super(TestCase, self).test()

        assert_equal(self.lines, [
            "I'm OK",
            "I'm OK",
            "The alphabet begins with a b c d e",
            "The interpolant is interpolated",
            "I'm OK still",
            "Success!",
        ])
开发者ID:Yelp,项目名称:ezio,代码行数:11,代码来源:oneline_conditionals.py

示例11: test

    def test(self):
        super(TestCase, self).test()

        expected_lines = [
                ''.join(' %d' % (num,) for num in xrange(10)),
                '0 a',
                '1 b',
                '2 c',
        ]

        assert_equal(self.lines, expected_lines)
开发者ID:Yelp,项目名称:ezio,代码行数:11,代码来源:builtins.py

示例12: test

 def test(self):
     super(SimpleTestCase, self).test()
     # sanity check: Python correctly decoded the UTF-8 characters in this file:
     assert_equal(display['fifth'], u'hommage \xe0 jack')
     # note that 'asdf' == u'asdf', so we don't need to explicitly prefix the
     # literals here with u:
     assert_equal(
         self.lines,
         ['first', '1', 'second', '2.0', 'third', 'asdf', 'fourth', 'ohaiunicode',
          'fifth', u'hommage \xe0 jack'
         ]
     )
开发者ID:Yelp,项目名称:ezio,代码行数:12,代码来源:unicode_coercion.py

示例13: test

    def test(self):
        """Default smoke test; ensure that setup runs, which ensures that compilation and templating will succeed
        without throwing exceptions.
        """
        self.expected_reference_counts = self.get_reference_counts()
        self.run_templating()

        self.expected_result = self.result
        for _ in xrange(self.num_stress_test_iterations):
            self.run_templating(quiet=True)
            # check that the result hasn't changed:
            assert_equal(self.result, self.expected_result)
            assert_equal(self.get_reference_counts(), self.expected_reference_counts)
开发者ID:eklitzke,项目名称:ezio,代码行数:13,代码来源:test_case.py

示例14: test

    def test(self):
        super(TestCase, self).test()

        expected_lines = [
                'respond: quux',
                'my_func: bar',
                'os.__file__: %s' % (os.__file__,),
                'again: %s' % (os.__file__,),
                'respond_reassignment: bat',
                'in_pipes: |bat|',
                DEFAULT_ARGUMENT,
                'this is the second call to my_func',
        ]
        assert_equal(self.lines, expected_lines)
开发者ID:Yelp,项目名称:ezio,代码行数:14,代码来源:set_statement.py

示例15: test_repr

    def test_repr(self):
        fd1 = fdict(a=1, b=2)
        T.assert_equal(repr(fd1), "fdict({'a': 1, 'b': 2})")
        T.assert_equal(eval(repr(fd1)), fd1)

        fd2 = fdict(c=3, **fd1)
        T.assert_equal(repr(fd2), "fdict({'a': 1, 'c': 3, 'b': 2})")
        T.assert_equal(eval(repr(fd2)), fd2)
开发者ID:bukzor,项目名称:scratch,代码行数:8,代码来源:frozendict_test.py


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