def _set_vertical_anchor(self, vertical_anchor): """ Set vertical_anchor of this cell to *vertical_anchor*, a constant value like ``MSO.ANCHOR_MIDDLE``. If *vertical_anchor* is |None|, any vertical anchor setting is cleared and its effective value is inherited. """ anchor = VerticalAnchor.to_text_anchoring_type(vertical_anchor) self.__tc.anchor = anchor
def _get_vertical_anchor(self): """ Return vertical anchor setting for this table cell, e.g. ``MSO.ANCHOR_MIDDLE``. Can be |None|, meaning the cell has no vertical anchor setting and its effective value is inherited from a higher-level object. """ anchor = self.__tc.anchor return VerticalAnchor.from_text_anchoring_type(anchor)
def test_to_text_anchoring_type_raises_on_bad_vertical_anchor(self): """VerticalAnchor.to_text_anchoring_type raises on bad key""" with self.assertRaises(KeyError): VerticalAnchor.to_text_anchoring_type("foobar")
def test_to_text_anchoring_type_return_value(self): """VerticalAnchor.to_text_anchoring_type returns correct value""" # verify ----------------------- for vertical_anchor, text_anchoring_type in self.cases: assert_that(VerticalAnchor.to_text_anchoring_type(vertical_anchor), is_(equal_to(text_anchoring_type)))