def test_expand(): doc = XML("<doc><hello>world</hello></doc>", fragment=False) assert type(doc) is ElementStream doc = doc.expand() assert type(doc) == type(Element('doc')) assert doc.tag == 'doc' assert doc[0].tag == 'hello' assert doc[0].text == 'world'