def xml_check_cases(propname): return ( # => True: tblPr and attribute should be added (a_tbl(), True, a_tbl().with_prop(propname, "1")), # => False: attribute should be removed if false (a_tbl().with_prop(propname, "1"), False, a_tbl().with_tblPr), # => False: attribute should not be added if false (a_tbl(), False, a_tbl()), )
def getter_cases(propname): """Test cases for boolean property getter tests""" return ( # defaults to False if no tblPr element present (a_tbl(), False), # defaults to False if tblPr element is empty (a_tbl().with_tblPr, False), # returns True if firstCol is valid truthy value (a_tbl().with_prop(propname, "1"), True), (a_tbl().with_prop(propname, "true"), True), # returns False if firstCol has valid False value (a_tbl().with_prop(propname, "0"), False), (a_tbl().with_prop(propname, "false"), False), # returns False if firstCol is not valid xsd:boolean value (a_tbl().with_prop(propname, "foobar"), False), )