Beispiel #1
0
class MaxLengthCheckTest(TestCase):
    def setUp(self):
        self.check = MaxLengthCheck()
        self.test_good_matching = (
            'strings',
            'less than 21',
            'max-length:12'
        )
        self.test_good_matching_unicode = (
            'strings',
            'less than 21',
            'max-length:12'
        )

    def test_check(self):
        self.assertFalse(
            self.check.check_target(
                [self.test_good_matching[0]],
                [self.test_good_matching[1]],
                MockUnit(flags=(self.test_good_matching[2]))
            )
        )

    def test_unicode_check(self):
        self.assertFalse(
            self.check.check_target(
                [self.test_good_matching_unicode[0]],
                [self.test_good_matching_unicode[1]],
                MockUnit(flags=(self.test_good_matching_unicode[2]))
            )
        )

    def test_failure_check(self):
        self.assertTrue(
            self.check.check_target(
                [self.test_good_matching[0]],
                [self.test_good_matching[1]],
                MockUnit(flags=('max-length:10'))
            )
        )

    def test_failure_unicode_check(self):
        self.assertTrue(
            self.check.check_target(
                [self.test_good_matching_unicode[0]],
                [self.test_good_matching_unicode[1]],
                MockUnit(flags=('max-length:10'))
            )
        )

    def test_multiple_flags_check(self):
        self.assertFalse(
            self.check.check_target(
                [self.test_good_matching_unicode[0]],
                [self.test_good_matching_unicode[1]],
                MockUnit(flags=('max-length:3,max-length:12'))
            )
        )
Beispiel #2
0
class MaxLengthCheckTest(TestCase):
    def setUp(self):
        self.check = MaxLengthCheck()
        self.test_good_matching = (
            'strings',
            'less than 21',
            'max-length:12'
        )
        self.test_good_matching_unicode = (
            u'strings',
            u'less than 21',
            'max-length:12'
        )

    def test_check(self):
        self.assertFalse(
            self.check.check_target(
                [self.test_good_matching[0]],
                [self.test_good_matching[1]],
                MockUnit(flags=(self.test_good_matching[2]))
            )
        )

    def test_unicode_check(self):
        self.assertFalse(
            self.check.check_target(
                [self.test_good_matching_unicode[0]],
                [self.test_good_matching_unicode[1]],
                MockUnit(flags=(self.test_good_matching_unicode[2]))
            )
        )

    def test_failure_check(self):
        self.assertTrue(
            self.check.check_target(
                [self.test_good_matching[0]],
                [self.test_good_matching[1]],
                MockUnit(flags=('max-length:10'))
            )
        )

    def test_failure_unicode_check(self):
        self.assertTrue(
            self.check.check_target(
                [self.test_good_matching_unicode[0]],
                [self.test_good_matching_unicode[1]],
                MockUnit(flags=('max-length:10'))
            )
        )

    def test_multiple_flags_check(self):
        self.assertFalse(
            self.check.check_target(
                [self.test_good_matching_unicode[0]],
                [self.test_good_matching_unicode[1]],
                MockUnit(flags=('max-length:3,max-length:12'))
            )
        )
Beispiel #3
0
 def setUp(self):
     self.check = MaxLengthCheck()
     self.test_good_matching = (
         'strings',
         'less than 21',
         'max-length:12'
     )
     self.test_good_matching_unicode = (
         'strings',
         'less than 21',
         'max-length:12'
     )
Beispiel #4
0
 def setUp(self):
     self.check = MaxLengthCheck()
     self.test_good_matching = (
         'strings',
         'less than 21',
         'max-length:12'
     )
     self.test_good_matching_unicode = (
         u'strings',
         u'less than 21',
         'max-length:12'
     )