예제 #1
0
    def test_code_re(self):
        validate_size({'code': 'small', 'wxh': '100x100'})
        validate_size({'code': 's', 'wxh': '100x100'})
        validate_size({'code': '2', 'wxh': '100x100'})

        self.assertRaises(SizeError, validate_size, {
            'code': ' ',
            'wxh': '100x100'
        })
        self.assertRaises(SizeError, validate_size, {
            'code': '&',
            'wxh': '100x100'
        })
        self.assertRaises(SizeError, validate_size, {
            'code': 's ',
            'wxh': '100x100'
        })
        self.assertRaises(SizeError, validate_size, {
            'code': 's!',
            'wxh': '100x100'
        })
        self.assertRaises(SizeError, validate_size, {
            'code': '2+',
            'wxh': '100x100'
        })
예제 #2
0
    def test_wxh_re(self):
        validate_size({'code': 'small', 'wxh': '100x100'})
        validate_size({'code': 'small', 'wxh': '5x5'})
        validate_size({'code': 'small', 'wxh': '1024x512'})

        # '100x' 'x100' now supported for fixed width, fixed heigh
        validate_size({'code': 'fixedwidth', 'wxh': '100x'})
        validate_size({'code': 'fixedheight', 'wxh': 'x100'})

        self.assertRaises(SizeError, validate_size,
            {'code': 'small', 'wxh': ''})
        self.assertRaises(SizeError, validate_size,
            {'code': 'small', 'wxh': 'x'})
        self.assertRaises(SizeError, validate_size,
            {'code': 'small', 'wxh': '100xx100'})
        self.assertRaises(SizeError, validate_size,
            {'code': 'small', 'wxh': 'x100x100'})
        self.assertRaises(SizeError, validate_size,
            {'code': 'small', 'wxh': '100x100x'})
        self.assertRaises(SizeError, validate_size,
            {'code': 'small', 'wxh': '1-0x100'})
        self.assertRaises(SizeError, validate_size,
            {'code': 'small', 'wxh': '100x 100'})
예제 #3
0
    def test_wxh_re(self):
        validate_size({'code': 'small', 'wxh': '100x100'})
        validate_size({'code': 'small', 'wxh': '5x5'})
        validate_size({'code': 'small', 'wxh': '1024x512'})

        # '100x' 'x100' now supported for fixed width, fixed heigh
        validate_size({'code': 'fixedwidth', 'wxh': '100x'})
        validate_size({'code': 'fixedheight', 'wxh': 'x100'})

        self.assertRaises(SizeError, validate_size, {
            'code': 'small',
            'wxh': ''
        })
        self.assertRaises(SizeError, validate_size, {
            'code': 'small',
            'wxh': 'x'
        })
        self.assertRaises(SizeError, validate_size, {
            'code': 'small',
            'wxh': '100xx100'
        })
        self.assertRaises(SizeError, validate_size, {
            'code': 'small',
            'wxh': 'x100x100'
        })
        self.assertRaises(SizeError, validate_size, {
            'code': 'small',
            'wxh': '100x100x'
        })
        self.assertRaises(SizeError, validate_size, {
            'code': 'small',
            'wxh': '1-0x100'
        })
        self.assertRaises(SizeError, validate_size, {
            'code': 'small',
            'wxh': '100x 100'
        })
예제 #4
0
    def test_code_re(self):
        validate_size({'code': 'small', 'wxh': '100x100'})
        validate_size({'code': 's', 'wxh': '100x100'})
        validate_size({'code': '2', 'wxh': '100x100'})

        self.assertRaises(SizeError, validate_size,
            {'code': ' ', 'wxh': '100x100'})
        self.assertRaises(SizeError, validate_size,
            {'code': '&', 'wxh': '100x100'})
        self.assertRaises(SizeError, validate_size,
            {'code': 's ', 'wxh': '100x100'})
        self.assertRaises(SizeError, validate_size,
            {'code': 's!', 'wxh': '100x100'})
        self.assertRaises(SizeError, validate_size,
            {'code': '2+', 'wxh': '100x100'})
예제 #5
0
 def test_resize_valid(self):
     validate_size({'code': 'small', 'wxh': '100x100', 'resize': 'crop'})
     validate_size({'code': 'small', 'wxh': '100x100', 'resize': 'scale'})
예제 #6
0
 def test_resize_optional(self):
     validate_size({'code': 'small', 'wxh': '100x100'})
예제 #7
0
    def test_code_wxh_required(self):
        validate_size({'code': 'small', 'wxh': '100x100'})

        self.assertRaises(SizeError, validate_size, {'code': 'small'})
        self.assertRaises(SizeError, validate_size, {'wxh': '100x100'})
        self.assertRaises(SizeError, validate_size, {})
예제 #8
0
 def test_resize_valid(self):
     validate_size({'code': 'small', 'wxh': '100x100', 'resize': 'crop'})
     validate_size({'code': 'small', 'wxh': '100x100', 'resize': 'scale'})
예제 #9
0
 def test_resize_optional(self):
     validate_size({'code': 'small', 'wxh': '100x100'})
예제 #10
0
    def test_code_wxh_required(self):
        validate_size({'code': 'small', 'wxh': '100x100'})

        self.assertRaises(SizeError, validate_size, {'code': 'small'})
        self.assertRaises(SizeError, validate_size, {'wxh': '100x100'})
        self.assertRaises(SizeError, validate_size, {})