當前位置: 首頁>>代碼示例>>Python>>正文


Python Workflow.validate方法代碼示例

本文整理匯總了Python中models.courses.Workflow.validate方法的典型用法代碼示例。如果您正苦於以下問題:Python Workflow.validate方法的具體用法?Python Workflow.validate怎麽用?Python Workflow.validate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.courses.Workflow的用法示例。


在下文中一共展示了Workflow.validate方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_not_dict

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
    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,代碼行數:12,代碼來源:models_courses.py

示例2: test_submission_date_after_review_date_fails

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
 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,代碼行數:12,代碼來源:models_courses.py

示例3: test_multiple_errors

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
 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,代碼行數:14,代碼來源:models_courses.py

示例4: test_invalid_date

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
    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,代碼行數:16,代碼來源:models_courses.py

示例5: test_invalid_human_grader

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
    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,代碼行數:19,代碼來源:models_courses.py

示例6: test_invalid_review_min_count

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
    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,代碼行數:23,代碼來源:models_courses.py

示例7: test_invalid_string

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
 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,代碼行數:7,代碼來源:models_courses.py

示例8: test_empty_string

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
 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,代碼行數:7,代碼來源:models_courses.py

示例9: test_valid_human_grader

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
 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,代碼行數:8,代碼來源:models_courses.py

示例10: test_empty_submission_date_in_grader

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
 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,代碼行數:8,代碼來源:models_courses.py

示例11: test_auto_grader

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
 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,代碼行數:7,代碼來源:models_courses.py

示例12: test_missing_grader_key

# 需要導入模塊: from models.courses import Workflow [as 別名]
# 或者: from models.courses.Workflow import validate [as 別名]
 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,代碼行數:7,代碼來源:models_courses.py


注:本文中的models.courses.Workflow.validate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。