def description_html(desc): """ 将用例中的描述转成HTML对象 :param desc: 描述 :return: """ if desc is None: return "No case description" desc_ = "" for i in range(len(desc)): if i == 0: pass elif desc[i] == '\n': desc_ = desc_ + ";" else: desc_ = desc_ + desc[i] desc_lines = desc_.split(";") desc_html = html.html( html.head( html.meta(name="Content-Type", value="text/html; charset=latin1")), html.body([html.p(line) for line in desc_lines])) return desc_html
def test_class_None(): t = html.body(class_=None) u = unicode(t) assert u == '<body></body>'