Exemplo n.º 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'
        })
Exemplo n.º 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'})
Exemplo n.º 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'
        })
Exemplo n.º 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'})
Exemplo n.º 5
0
 def test_resize_valid(self):
     validate_size({'code': 'small', 'wxh': '100x100', 'resize': 'crop'})
     validate_size({'code': 'small', 'wxh': '100x100', 'resize': 'scale'})
Exemplo n.º 6
0
 def test_resize_optional(self):
     validate_size({'code': 'small', 'wxh': '100x100'})
Exemplo n.º 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, {})
Exemplo n.º 8
0
 def test_resize_valid(self):
     validate_size({'code': 'small', 'wxh': '100x100', 'resize': 'crop'})
     validate_size({'code': 'small', 'wxh': '100x100', 'resize': 'scale'})
Exemplo n.º 9
0
 def test_resize_optional(self):
     validate_size({'code': 'small', 'wxh': '100x100'})
Exemplo n.º 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, {})