예제 #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)
예제 #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')
예제 #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()
예제 #4
0
 def test_set_italic(self):
     styleobj = Style()
     styleobj.italic = True
     self.assertTrue(styleobj.italic)
예제 #5
0
 def test_set_size(self):
     styleobj = Style()
     styleobj.size = 11
     self.assertEqual(styleobj.size, 11)
예제 #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
예제 #7
0
 def test_set_underline(self):
     styleobj = Style()
     styleobj.underline = True
     self.assertTrue(styleobj.underline)
예제 #8
0
 def test_fail_set_underline(self):
     styleobj = Style()
     with self.assertRaises(TypeError):
         styleobj.underline = 1
     with self.assertRaises(TypeError):
         styleobj.underline = "True"
예제 #9
0
 def test_set_strike(self):
     styleobj = Style()
     styleobj.strike = True
     self.assertTrue(styleobj.strike)
예제 #10
0
 def test_fail_set_strike(self):
     styleobj = Style()
     with self.assertRaises(TypeError):
         styleobj.strike = 1
예제 #11
0
 def test_set_a_correct_font(self):
     font = "calibri.ttf"
     styleobj = Style()
     styleobj.font = font
     self.assertEqual(font, styleobj.font)
예제 #12
0
 def test_fail_set_italic(self):
     styleobj = Style()
     with self.assertRaises(TypeError):
         styleobj.italic = 1
예제 #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
예제 #14
0
 def test_set_fill(self):
     styleobj = Style()
     styleobj.fill = 'fff'
     self.assertEqual(styleobj.fill, 'fff')
예제 #15
0
 def test_set_bad_bold(self):
     styleobj = Style()
     with self.assertRaises(TypeError):
         styleobj.bold = 1
     with self.assertRaises(TypeError):
         styleobj.bold = "True"
예제 #16
0
 def test_set_bold(self):
     styleobj = Style()
     styleobj.bold = True
     self.assertTrue(styleobj.bold)
     styleobj.bold = False
     self.assertFalse(styleobj.bold)
예제 #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)