• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python assertions.assert_equal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: perform_exception_test

    def perform_exception_test(self, exc_class):
        self.expected_reference_counts = self.get_reference_counts()
        for _ in xrange(self.num_stress_test_iterations + 1):
            # there's a fun wrinkle here. we have to make sure the raised exception
            # is completely out of scope and destroyed before we check the reference
            # counts again; otherwise it may hold incidental references to objects,
            # which will appear to the reference count checks here as though it were
            # a memory leak. not that this, you know, actually happened to me or anything.
            assert_raises(exc_class, self.run_templating)
            assert_equal(self.get_reference_counts(), self.expected_reference_counts)

        try:
            self.run_templating()
        except exc_class, e:
            # now that we're done counting references, save the exception for examination:
            self.exception = e
开发者ID:Yelp,项目名称:ezio,代码行数:16,代码来源:test_case.py


示例17: 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:pyarnold,项目名称:Testify,代码行数:17,代码来源:test_program_test.py


示例18: assert_rerun_discovery

    def assert_rerun_discovery(self, format):
        output = test_call([
            'sh', '-c', '''\
{python} -m testify.test_program --list-tests test.test_suites_test --list-tests-format {format} |
{python} -m testify.test_program -v --require-suite example --exclude-suite disabled --exclude-suite assertion --rerun-test-file -
'''.format(python=sys.executable, format=format)
        ])
        output = re.sub(r'\b[0-9.]+s\b', '${TIME}', output)
        assert_equal(output, '''\
test.test_suites_test ListSuitesTestCase.<lambda> ... ok in ${TIME}
test.test_suites_test ListSuitesTestCase.test_not_disabled ... ok in ${TIME}
test.test_suites_test TestifiedListSuitesUnittestCase.test_not_disabled ... ok in ${TIME}
test.test_suites_test SubDecoratedTestCase.test_thing ... ok in ${TIME}
test.test_suites_test SubTestCase.test_thing ... ok in ${TIME}
test.test_suites_test SuperDecoratedTestCase.test_thing ... ok in ${TIME}
test.test_suites_test SuperTestCase.test_thing ... ok in ${TIME}

PASSED.  7 tests / 6 cases: 7 passed, 0 failed.  (Total test time ${TIME})''')
开发者ID:Yelp,项目名称:Testify,代码行数:18,代码来源:test_program_test.py


示例19: test

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

        modules = [
            "bisect",
            "os",
            "os",
            "os.path",
            "email.utils",
            "email.errors",
            "email.mime.image",
            "email.mime.image",
            "email",
            "email.charset",
            "xml.dom.minidom",
        ]
        files = [sys.modules[module].__file__ for module in modules]
        assert_equal(self.lines, files)
开发者ID:pombredanne,项目名称:ezio,代码行数:18,代码来源:imports.py


示例20: test_cheap_hash

    def test_cheap_hash(self):
        import mock
        import __builtin__
        with mock.patch.object(__builtin__, 'hash', wraps=hash) as mock_hash:
            fd = fdict(a=1)

            T.assert_equal((('a', 1),).__hash__(), fd.__hash__())
            T.assert_equal(1, mock_hash.call_count)

            T.assert_equal((('a', 1),).__hash__(), fd.__hash__())
            T.assert_equal(1, mock_hash.call_count)
开发者ID:bukzor,项目名称:scratch,代码行数:11,代码来源:frozendict_test.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python assertions.assert_in函数代码示例发布时间:2022-05-27
下一篇:
Python assertions.assert_empty函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap