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


Python testify.assert_equal函数代码示例

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


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


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