Ejemplo n.º 1
0
 def test_set_cell_style(self):
     styleobj = Style()
     objects = [[1], {1: 2}, (1, ), ' ', -1]
     cell = Cell('test', styleobj)
     cell = Cell()
     cell.style = styleobj
     for object in objects:
         with self.assertRaises(TypeError):
             cell = Cell('test', object)
Ejemplo n.º 2
0
 def test_set_styles_from_signature(self):
     styleobj = Style(12, 'abc', True, True, 'test', True, True, 'aabbcc')
     self.assertTrue(styleobj.bold)
     self.assertTrue(styleobj.strike)
     self.assertTrue(styleobj.underline)
     self.assertTrue(styleobj.italic)
     self.assertEqual(styleobj.fill, 'aabbcc')
     self.assertEqual(styleobj.color, 'abc')
     self.assertEqual(styleobj.font, 'test')
Ejemplo n.º 3
0
    def __init__(self, value=None, styleobj=None, x=0, y=0, **kwargs):

        # init private vars
        self._fill = None
        self._value = None
        self._format_string = None
        self._style = None
        self._parent = None
        self.x = x
        self.y = y
        # set properties
        self.value = value
        if styleobj:
            self.style = styleobj
        else:
            self.style = Style()
Ejemplo n.º 4
0
 def test_set_italic(self):
     styleobj = Style()
     styleobj.italic = True
     self.assertTrue(styleobj.italic)
Ejemplo n.º 5
0
 def test_set_size(self):
     styleobj = Style()
     styleobj.size = 11
     self.assertEqual(styleobj.size, 11)
Ejemplo n.º 6
0
 def test_set_bad_size_value(self):
     styleobj = Style()
     with self.assertRaises(TypeError):
         styleobj.size = 'a'
     with self.assertRaises(TypeError):
         styleobj.size = False
Ejemplo n.º 7
0
 def test_set_underline(self):
     styleobj = Style()
     styleobj.underline = True
     self.assertTrue(styleobj.underline)
Ejemplo n.º 8
0
 def test_fail_set_underline(self):
     styleobj = Style()
     with self.assertRaises(TypeError):
         styleobj.underline = 1
     with self.assertRaises(TypeError):
         styleobj.underline = "True"
Ejemplo n.º 9
0
 def test_set_strike(self):
     styleobj = Style()
     styleobj.strike = True
     self.assertTrue(styleobj.strike)
Ejemplo n.º 10
0
 def test_fail_set_strike(self):
     styleobj = Style()
     with self.assertRaises(TypeError):
         styleobj.strike = 1
Ejemplo n.º 11
0
 def test_set_a_correct_font(self):
     font = "calibri.ttf"
     styleobj = Style()
     styleobj.font = font
     self.assertEqual(font, styleobj.font)
Ejemplo n.º 12
0
 def test_fail_set_italic(self):
     styleobj = Style()
     with self.assertRaises(TypeError):
         styleobj.italic = 1
Ejemplo n.º 13
0
 def test_fail_set_bad_fill(self):
     styleobj = Style()
     with self.assertRaises(ValueError):
         styleobj.fill = 'abz171'
     with self.assertRaises(TypeError):
         styleobj.fill = False
Ejemplo n.º 14
0
 def test_set_fill(self):
     styleobj = Style()
     styleobj.fill = 'fff'
     self.assertEqual(styleobj.fill, 'fff')
Ejemplo n.º 15
0
 def test_set_bad_bold(self):
     styleobj = Style()
     with self.assertRaises(TypeError):
         styleobj.bold = 1
     with self.assertRaises(TypeError):
         styleobj.bold = "True"
Ejemplo n.º 16
0
 def test_set_bold(self):
     styleobj = Style()
     styleobj.bold = True
     self.assertTrue(styleobj.bold)
     styleobj.bold = False
     self.assertFalse(styleobj.bold)
Ejemplo n.º 17
0
 def test_set_an_incorrect_font(self):
     font = 123
     styleobj = Style()
     with self.assertRaises(TypeError):
         styleobj.font = font
         self.assertEqual(font, styleobj.font)