def test_none(self): """ Frames with empty (None) commands/responses should still export. """ frame = Coqdoc_Frame(command = None, command_cd = None, response = None) xml = frame.toxml(doc = BeautifulStoneSoup()) self.assertEquals(xml.command.text, "") self.assertFalse(xml.response) self.assertFalse(xml.find(name = "command-coqdoc"))
def test_none(self): """ Frames with empty (None) commands/responses should still export. """ frame = Coqdoc_Frame(command=None, command_cd=None, response=None) xml = frame.toxml(doc=BeautifulStoneSoup()) self.assertEquals(xml.command.text, "") self.assertFalse(xml.response) self.assertFalse(xml.find(name="command-coqdoc"))
def test_export_entities(self): """ Entities that are already escaped should not be escaped again. """ frame = Coqdoc_Frame( command=" ", command_cd=BeautifulStoneSoup("<div> </div>")) xml = frame.toxml(doc=BeautifulStoneSoup()) self.assertEquals(xml.find(name="command-coqdoc").div.text, " ")
def test_export_entities(self): """ Entities that are already escaped should not be escaped again. """ frame = Coqdoc_Frame(command =" ", command_cd = BeautifulStoneSoup("<div> </div>")) xml = frame.toxml(doc = BeautifulStoneSoup()) self.assertEquals(xml.find(name = "command-coqdoc").div.text, " ")
def test_nested_entities(self): """ Test that entities in elements escape correctly. """ soup = BeautifulStoneSoup("<div>&</div>") frame = Coqdoc_Frame(command="foo", response="bar", command_cd=soup) xml = frame.toxml(doc=BeautifulStoneSoup()) self.assertEquals(str(xml.find(name="command-coqdoc").div), "<div>&</div>")
def test_nested_entities(self): """ Test that entities in elements escape correctly. """ soup = BeautifulStoneSoup("<div>&</div>") frame = Coqdoc_Frame(command = "foo", response = "bar", command_cd = soup) xml = frame.toxml(doc = BeautifulStoneSoup()) self.assertEquals(str(xml.find(name = "command-coqdoc").div), "<div>&</div>")
def test_entitities(self): """ Test that entities in command, response and coqdoc_command are exported to the correct entitity codes when exporting to XML. """ frame = Coqdoc_Frame(command="&", command_cd="&", response="&") xml = frame.toxml(doc=BeautifulStoneSoup()) self.assertEquals(xml.command.text, "&") self.assertEquals(xml.response.text, "&")
def test_entitities(self): """ Test that entities in command, response and coqdoc_command are exported to the correct entitity codes when exporting to XML. """ frame = Coqdoc_Frame(command = "&", command_cd = "&", response = "&") xml = frame.toxml(doc = BeautifulStoneSoup()) self.assertEquals(xml.command.text, "&") self.assertEquals(xml.response.text, "&")