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

Python courses.Workflow类代码示例

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

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



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

示例1: test_valid_datetime

 def test_valid_datetime(self):
     """Valid datetimes should be converted without problems."""
     workflow = Workflow('')
     date_obj = workflow._convert_date_string_to_datetime('2012-03-21 12:30')
     self.assertEqual(date_obj.year, 2012)
     self.assertEqual(date_obj.month, 3)
     self.assertEqual(date_obj.day, 21)
     self.assertEqual(date_obj.hour, 12)
     self.assertEqual(date_obj.minute, 30)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:9,代码来源:models_courses.py


示例2: test_not_dict

    def test_not_dict(self):
        """Validation should fail for non-dict YAML strings."""
        yaml_strs = ['- first\n- second', 'grader']

        for yaml_str in yaml_strs:
            self.errors = []
            workflow = Workflow(yaml_str)
            workflow.validate(self.errors)
            self.assert_matching_errors(
                ['expected the YAML representation of a dict'], self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:10,代码来源:models_courses.py


示例3: test_invalid_datetime

    def test_invalid_datetime(self):
        """Valid datetimes should be converted without problems."""
        invalid_date_strs = [
            'abc', '2012-13-31 12:30', '2012-12-31T12:30',
            '2012-13-31 12:30+0100']

        workflow = Workflow('')
        for date_str in invalid_date_strs:
            with self.assertRaises(Exception):
                workflow._convert_date_string_to_datetime(date_str)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:10,代码来源:models_courses.py


示例4: test_submission_date_after_review_date_fails

 def test_submission_date_after_review_date_fails(self):
     """Validation should fail if review date precedes submission date."""
     workflow_dict = self.valid_human_review_workflow_dict
     workflow_dict['submission_due_date'] = '2013-03-14 12:00'
     workflow_dict['review_due_date'] = '2013-03-13 12:00'
     workflow = Workflow(self.to_yaml(workflow_dict))
     workflow.validate(self.errors)
     self.assert_matching_errors(
         ['submission due date should be earlier than review due date.'],
         self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:10,代码来源:models_courses.py


示例5: test_multiple_errors

 def test_multiple_errors(self):
     """Validation should fail with multiple errors when appropriate."""
     workflow_dict = self.valid_human_review_workflow_dict
     workflow_dict['submission_due_date'] = '2013-03-14 12:00'
     workflow_dict['review_due_date'] = '2013-03-13 12:00'
     workflow_dict['review_window_mins'] = 'hello'
     workflow = Workflow(self.to_yaml(workflow_dict))
     workflow.validate(self.errors)
     self.assert_matching_errors(
         ['review_window_mins should be an integer; submission due date '
          'should be earlier than review due date.'],
         self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:12,代码来源:models_courses.py


示例6: test_invalid_review_min_count

    def test_invalid_review_min_count(self):
        """Validation should fail for bad review_min_count values."""
        workflow_dict = self.valid_human_review_workflow_dict
        workflow_dict['review_min_count'] = 'test_string'
        workflow = Workflow(self.to_yaml(workflow_dict))
        workflow.validate(self.errors)
        self.assert_matching_errors(
            ['review_min_count should be an integer.'], self.errors)

        self.errors = []
        workflow_dict['review_min_count'] = -1
        workflow = Workflow(self.to_yaml(workflow_dict))
        workflow.validate(self.errors)
        self.assert_matching_errors(
            ['review_min_count should be a non-negative integer.'], self.errors)

        self.errors = []
        workflow_dict['review_min_count'] = 0
        workflow = Workflow(self.to_yaml(workflow_dict))
        workflow.validate(self.errors)
        self.assertFalse(self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:21,代码来源:models_courses.py


示例7: test_invalid_date

    def test_invalid_date(self):
        """Validation should fail for invalid dates."""
        workflow_dict = self.valid_human_review_workflow_dict
        workflow_dict['submission_due_date'] = 'test_string'
        workflow = Workflow(self.to_yaml(workflow_dict))
        workflow.validate(self.errors)
        self.assert_matching_errors([DATE_FORMAT_ERROR], self.errors)

        self.errors = []
        workflow_dict = self.valid_human_review_workflow_dict
        workflow_dict['review_due_date'] = 'test_string'
        workflow = Workflow(self.to_yaml(workflow_dict))
        workflow.validate(self.errors)
        self.assert_matching_errors([DATE_FORMAT_ERROR], self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:14,代码来源:models_courses.py


示例8: test_invalid_human_grader

    def test_invalid_human_grader(self):
        """Validation should fail for invalid human grading specifications."""
        workflow = Workflow(self.to_yaml({'grader': 'human'}))
        workflow.validate(self.errors)
        self.assert_matching_errors([
            '%s matcher, review_min_count, review_window_mins, '
            'submission_due_date, review_due_date.' %
            MISSING_KEYS_PREFIX], self.errors)

        self.errors = []
        workflow = Workflow(self.to_yaml(
            {'grader': 'human', 'matcher': 'peer'}
        ))
        workflow.validate(self.errors)
        self.assert_matching_errors([
            '%s review_min_count, review_window_mins, submission_due_date, '
            'review_due_date.' % MISSING_KEYS_PREFIX], self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:17,代码来源:models_courses.py


示例9: test_invalid_string

 def test_invalid_string(self):
     """Validation should fail for invalid YAML strings."""
     workflow = Workflow('(')
     workflow.validate(self.errors)
     self.assertTrue(self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:5,代码来源:models_courses.py


示例10: test_empty_string

 def test_empty_string(self):
     """Validation should fail on an empty string."""
     workflow = Workflow('')
     workflow.validate(self.errors)
     self.assert_matching_errors(['missing key: grader.'], self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:5,代码来源:models_courses.py


示例11: test_no_timezone_set

 def test_no_timezone_set(self):
     """Parsed date strings should contain no timezone information."""
     workflow = Workflow('')
     date_obj = workflow._convert_date_string_to_datetime('2012-03-21 12:30')
     self.assertIsNone(date_obj.tzinfo)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:5,代码来源:models_courses.py


示例12: test_valid_human_grader

 def test_valid_human_grader(self):
     """Validation should pass for valid human grading specifications."""
     workflow_dict = self.valid_human_review_workflow_dict
     workflow = Workflow(self.to_yaml(workflow_dict))
     workflow.validate(self.errors)
     self.assertFalse(self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:6,代码来源:models_courses.py


示例13: test_empty_submission_date_in_grader

 def test_empty_submission_date_in_grader(self):
     """Validation should pass for empty submission date."""
     workflow = Workflow(self.to_yaml(
         {'grader': 'auto', 'submission_due_date': ''}))
     workflow.validate(self.errors)
     self.assertFalse(self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:6,代码来源:models_courses.py


示例14: test_auto_grader

 def test_auto_grader(self):
     """Validation should pass for an auto-graded assessment."""
     workflow = Workflow(self.to_yaml({'grader': 'auto'}))
     workflow.validate(self.errors)
     self.assertFalse(self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:5,代码来源:models_courses.py


示例15: test_missing_grader_key

 def test_missing_grader_key(self):
     """Validation should fail for missing grader key."""
     workflow = Workflow(self.to_yaml({'not_grader': 'human'}))
     workflow.validate(self.errors)
     self.assert_matching_errors(['missing key: grader.'], self.errors)
开发者ID:2023SS,项目名称:coursebuilder-core,代码行数:5,代码来源:models_courses.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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