예제 #1
0
파일: tests.py 프로젝트: garym/ArangoPy
    def test_equals(self):

        choice1 = ChoiceField(choices=[
            ('DESCRIPTION', 'value'),
            ('DESCRIPTION 2', 'value2'),
        ])

        choice1.set('value')

        choice2 = ChoiceField(choices=[
            ('DESCRIPTION', 'value'),
            ('DESCRIPTION 2', 'value2'),
        ])

        choice2.set('value')

        self.assertEqual(choice1, choice2)
예제 #2
0
    def test_equals(self):

        choice1 = ChoiceField(choices=[
            ('value', 'DESCRIPTION'),
            ('value2', 'DESCRIPTION 2'),
        ])

        choice1.set('value')

        choice2 = ChoiceField(choices=[
            ('value', 'DESCRIPTION'),
            ('value2', 'DESCRIPTION 2'),
        ])

        choice2.set('value')

        self.assertEqual(choice1, choice2)
예제 #3
0
    def test_field_validation(self):

        choice = ChoiceField(choices=[
            ('value', 'DESCRIPTION'),
            ('value2', 'DESCRIPTION 2'),
        ])

        had_exception = False

        try:
            choice.set('not_valid_value')
        except Exception as err:
            had_exception = True

        self.assertTrue(had_exception, 'The value is not valid')

        choice.set('value2')
        self.assertTrue(True, 'The value is valid')
예제 #4
0
파일: tests.py 프로젝트: garym/ArangoPy
    def test_field_validation(self):

        choice = ChoiceField(choices=[
            ('DESCRIPTION', 'value'),
            ('DESCRIPTION 2', 'value2'),
        ])

        had_exception = False

        try:
            choice.set('not_valid_value')
        except Exception as err:
            had_exception = True


        self.assertTrue(had_exception, 'The value is not valid')

        choice.set('value2')
        self.assertTrue(True, 'The value is valid')