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

Python testify.assert_equal函数代码示例

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

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



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

示例1: test_cron_scheduler

 def test_cron_scheduler(self):
     line = "cron */5 * * 7,8 *"
     config = schedule_parse.valid_schedule('test', line)
     sched = scheduler.scheduler_from_config(config, mock.Mock())
     start_time = datetime.datetime(2012, 3, 14, 15, 9, 26)
     next_time = sched.next_run_time(start_time)
     assert_equal(next_time, datetime.datetime(2012, 7, 1, 0))
开发者ID:Bklyn,项目名称:Tron,代码行数:7,代码来源:scheduler_test.py


示例2: test_get_api_page

 def test_get_api_page(self):
     MockedSettings['api_app'] = {'port': 8043, 'servername': 'push.test.com'}
     with mock.patch.dict(Settings, MockedSettings):
         T.assert_equal(
             RequestHandler.get_api_page("pushes"),
             "http://push.test.com:8043/api/pushes"
         )
开发者ID:eevee,项目名称:pushmanager,代码行数:7,代码来源:test_core_requesthandler.py


示例3: test_basic

 def test_basic(self):
     def fcn(i, to_add):
         return i + to_add
     T.assert_equal(
         set(vimap.ext.sugar.imap_unordered(fcn, [1, 2, 3], to_add=1)),
         set([2, 3, 4])
     )
开发者ID:gatoatigrado,项目名称:vimap,代码行数:7,代码来源:sugar_test.py


示例4: test_end_to_end

    def test_end_to_end(self):
        n_file_path = os.path.join(self.tmp_dir, 'n_file')

        with open(n_file_path, 'w') as f:
            f.write('3')

        os.environ['LOCAL_N_FILE_PATH'] = n_file_path

        stdin = ['0\n', '1\n', '2\n']

        mr_job = MRTowerOfPowers(['--no-conf', '-v', '--cleanup=NONE', '--n-file', n_file_path])
        assert_equal(len(mr_job.steps()), 3)

        mr_job.sandbox(stdin=stdin)

        with mr_job.make_runner() as runner:
            assert isinstance(runner, LocalMRJobRunner)
            # make sure our file gets "uploaded"
            assert [fd for fd in runner._files if fd['path'] == n_file_path]

            runner.run()
            output = set()
            for line in runner.stream_output():
                _, value = mr_job.parse_output_line(line)
                output.add(value)

        assert_equal(set(output), set([0, 1, ((2**3)**3)**3]))
开发者ID:Jyrsa,项目名称:mrjob,代码行数:27,代码来源:job_test.py


示例5: test_default_mode

    def test_default_mode(self):
        # Turn off umask for inital testing of modes
        os.umask(0000)

        # Create a db, check default mode is 0666
        sqlite3dbm.dbm.SqliteMap(self.path, flag='c')
        testify.assert_equal(self.get_perm_mask(self.path), 0666)
开发者ID:Yelp,项目名称:sqlite3dbm,代码行数:7,代码来源:dbm_test.py


示例6: test_create_tasks

 def test_create_tasks(self):
     self.instance.create_tasks()
     assert_equal(self.instance.watch.mock_calls, [
         mock.call(self.instance.monitor_task),
         mock.call(self.instance.start_task),
         mock.call(self.instance.stop_task),
     ])
开发者ID:Feriority,项目名称:Tron,代码行数:7,代码来源:serviceinstance_test.py


示例7: test_get_value_cached

 def test_get_value_cached(self):
     expected = "the other stars"
     validator = mock.Mock()
     value_proxy = proxy.ValueProxy(validator, self.value_cache, 'something.string')
     value_proxy._value =  expected
     assert_equal(value_proxy.value, expected)
     validator.assert_not_called()
开发者ID:Roguelazer,项目名称:PyStaticConfiguration,代码行数:7,代码来源:proxy_test.py


示例8: test_multistarted_gradient_descent_optimizer_crippled_start

    def test_multistarted_gradient_descent_optimizer_crippled_start(self):
        """Check that multistarted GD is finding the best result from GD."""
        # Only allow 1 GD iteration.
        gd_parameters_crippled = GradientDescentParameters(
            1,
            1,
            self.gd_parameters.num_steps_averaged,
            self.gd_parameters.gamma,
            self.gd_parameters.pre_mult,
            self.gd_parameters.max_relative_change,
            self.gd_parameters.tolerance,
        )
        gradient_descent_optimizer_crippled = GradientDescentOptimizer(self.domain, self.polynomial, gd_parameters_crippled)

        num_points = 15
        points = self.domain.generate_uniform_random_points_in_domain(num_points)

        multistart_optimizer = MultistartOptimizer(gradient_descent_optimizer_crippled, num_points)
        test_best_point, _ = multistart_optimizer.optimize(random_starts=points)
        # This point set won't include the optimum so multistart GD won't find it.
        for value in (test_best_point - self.polynomial.optimum_point):
            T.assert_not_equal(value, 0.0)

        points_with_opt = numpy.append(points, self.polynomial.optimum_point.reshape((1, self.polynomial.dim)), axis=0)
        test_best_point, _ = multistart_optimizer.optimize(random_starts=points_with_opt)
        # This point set will include the optimum so multistart GD will find it.
        for value in (test_best_point - self.polynomial.optimum_point):
            T.assert_equal(value, 0.0)
开发者ID:Recmo,项目名称:MOE,代码行数:28,代码来源:optimization_test.py


示例9: test_read_raw_config

 def test_read_raw_config(self):
     name = 'name'
     path = os.path.join(self.temp_dir, name)
     manager.write(path, self.content)
     self.manifest.get_file_name.return_value = path
     config = self.manager.read_raw_config(name)
     assert_equal(config, yaml.dump(self.content))
开发者ID:Feriority,项目名称:Tron,代码行数:7,代码来源:manager_test.py


示例10: test_monthly

    def test_monthly(self):
        cfg = parse_daily('1st day')
        sch = scheduler.GeneralScheduler(**cfg._asdict())
        next_run_date = sch.next_run_time(None)

        assert_gt(next_run_date, self.now)
        assert_equal(next_run_date.month, 7)
开发者ID:Bklyn,项目名称:Tron,代码行数:7,代码来源:scheduler_test.py


示例11: test_display_scheduler_with_jitter

 def test_display_scheduler_with_jitter(self):
     source = {
         'value': '5 minutes',
         'type': 'interval',
         'jitter': ' (+/- 2 min)'}
     result = display.display_scheduler(source)
     assert_equal(result, 'interval 5 minutes%s' % (source['jitter']))
开发者ID:tsheasha,项目名称:Tron,代码行数:7,代码来源:display_test.py


示例12: test_wildcards

 def test_wildcards(self):
     cfg = parse_daily('every day')
     assert_equal(cfg.ordinals, None)
     assert_equal(cfg.monthdays, None)
     assert_equal(cfg.weekdays, None)
     assert_equal(cfg.months, None)
     assert_equal(cfg.timestr, '00:00')
开发者ID:Bklyn,项目名称:Tron,代码行数:7,代码来源:scheduler_test.py


示例13: test_parse_no_month

 def test_parse_no_month(self):
     cfg = parse_daily('1st,2nd,3rd,10th day at 00:00')
     assert_equal(cfg.ordinals, None)
     assert_equal(cfg.monthdays, set((1,2,3,10)))
     assert_equal(cfg.weekdays, None)
     assert_equal(cfg.months, None)
     assert_equal(cfg.timestr, '00:00')
开发者ID:Bklyn,项目名称:Tron,代码行数:7,代码来源:scheduler_test.py


示例14: test_parse_no_weekday

 def test_parse_no_weekday(self):
     cfg = parse_daily('1st,2nd,3rd,10th day of march,apr,September at 00:00')
     assert_equal(cfg.ordinals, None)
     assert_equal(cfg.monthdays, set((1,2,3,10)))
     assert_equal(cfg.weekdays, None)
     assert_equal(cfg.months, set((3, 4, 9)))
     assert_equal(cfg.timestr, '00:00')
开发者ID:Bklyn,项目名称:Tron,代码行数:7,代码来源:scheduler_test.py


示例15: test_handle_complete_failed

    def test_handle_complete_failed(self):
        action = mock.create_autospec(ActionCommand, is_failed=True)
        with mock.patch('tron.core.serviceinstance.log', autospec=True) as mock_log:
            self.task._handle_complete(action)
            assert_equal(mock_log.error.call_count, 1)

        self.task.notify.assert_called_with(self.task.NOTIFY_SUCCESS)
开发者ID:Feriority,项目名称:Tron,代码行数:7,代码来源:serviceinstance_test.py


示例16: test_get_file_mapping

 def test_get_file_mapping(self):
     file_mapping = {
         'one': 'a.yaml',
         'two': 'b.yaml',
     }
     manager.write(self.manifest.filename, file_mapping)
     assert_equal(self.manifest.get_file_mapping(), file_mapping)
开发者ID:Feriority,项目名称:Tron,代码行数:7,代码来源:manager_test.py


示例17: test_handle_action_event_failstart

 def test_handle_action_event_failstart(self):
     action = mock.create_autospec(ActionCommand)
     event = ActionCommand.FAILSTART
     patcher = mock.patch('tron.core.serviceinstance.log', autospec=True)
     with patcher as mock_log:
         self.task.handle_action_event(action, event)
         assert_equal(mock_log.warn.call_count, 1)
开发者ID:Feriority,项目名称:Tron,代码行数:7,代码来源:serviceinstance_test.py


示例18: test_valid_original_config

    def test_valid_original_config(self):
        test_config = self.BASE_CONFIG + """
jobs:
    -
        name: "test_job0"
        node: node0
        schedule: "interval 20s"
        actions:
        """
        expected_result = {'MASTER': 
                           {'nodes': 
                            [{'hostname': 'localhost',
                              'name': 'local'}],
                            'config_name': 'MASTER',
                            'jobs': 
                            [{'node': 'node0',
                              'name': 'test_job0',
                              'actions': None,
                              'schedule': 'interval 20s'}],
                            'ssh_options': {'agent': True},
                            'state_persistence': {'store_type': 'shelve',
                                                  'name': 'state_data.shelve'}}}
        fd = open(self.filename,'w')
        fd.write(test_config)
        fd.close()
        assert_equal(expected_result, _initialize_original_config(self.filename))
开发者ID:anthonypt87,项目名称:Tron,代码行数:26,代码来源:controller_test.py


示例19: test_run

    def test_run(self):
        self.task.run()

        self.task.notify.assert_called_with(self.task.NOTIFY_START)
        self.task.node.submit_command.assert_called_with(self.task.action)
        self.task.hang_check_callback.start.assert_called_with()
        assert_equal(self.task.action.command, self.task.command)
开发者ID:Feriority,项目名称:Tron,代码行数:7,代码来源:serviceinstance_test.py


示例20: test_class_teardown_counted_as_failure_after_limit_reached

    def test_class_teardown_counted_as_failure_after_limit_reached(self):
        assert_equal(self.server.failure_count, 0)
        get_test(self.server, 'runner')

        # The following behavior is bad because it doesn't allow clients to
        # report class_teardown failures (which they are contractually
        # obligated to run regardless of any failure limit). See
        # https://github.com/Yelp/Testify/issues/120 for ideas about how to fix
        # this.
        #
        # For now, we write this test to pin down the existing behavior and
        # notice if it changes.
        test_case_name = self.dummy_test_case.__name__
        assert_raises_and_contains(
            ValueError,
            '%s not checked out.' % test_case_name,
            self.run_test,
            'runner',
        )
        # Verify that only N failing tests are run, where N is the server's
        # failure_limit.
        #
        # Once issue #120 is fixed, the failure count should (probably) be
        # TEST_RUNNER_SERVER_FAILURE_LIMIT + CLASS_TEARDOWN_FAILURES.
        assert_equal(self.server.failure_count, self.TEST_RUNNER_SERVER_FAILURE_LIMIT)
开发者ID:MiloJiang,项目名称:Testify,代码行数:25,代码来源:test_runner_server_test.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python testify.assert_in函数代码示例发布时间:2022-05-27
下一篇:
Python testify.assert_dicts_equal函数代码示例发布时间: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