def test_read_3(self): r = io.StringIO( "<Dates><Nineties>\t\t</Nineties><Eighties>\t</Eighties></Dates>") a = [''] b = wcdb_read(r, a) self.assertTrue(b == True) self.assertTrue( a[0] == "<Dates><Nineties></Nineties><Eighties></Eighties></Dates>")
def test_read_4(self): reader = StringIO.StringIO( "<Mathematics><Physics><Chemistry></Chemistry></Physics></Mathematics>" ) tree = wcdb_read(reader) treeStr = ET.tostring(tree) self.assertTrue( treeStr == "<Mathematics><Physics><Chemistry /></Physics></Mathematics>")
def test_read_2(self): r = io.StringIO( "<Cookies>\n\t<Thin Mints></Thin Mints>\n\t<Samoas></Samoas>\n</Cookies>" ) a = [''] b = wcdb_read(r, a) self.assertTrue(b == True) self.assertTrue( a[0] == "<Cookies><Thin Mints></Thin Mints><Samoas></Samoas></Cookies>")
def test_read_5(self): reader = StringIO.StringIO("<Herp><Derp></Derp></Herp>") tree = wcdb_read(reader) treeStr = ET.tostring(tree) self.assertTrue(treeStr == "<Herp><Derp /></Herp>")
def test_read_3(self): reader = StringIO.StringIO("<W><C><D><B></B></D></C></W>") tree = wcdb_read(reader) treeStr = ET.tostring(tree) self.assertTrue(treeStr == "<W><C><D><B /></D></C></W>")
def test_read_tabs(self): reader = StringIO.StringIO("<one> \t<two> \t </two> \n</one>") tree = wcdb_read(reader) treeStr = ET.tostring(tree) self.assertTrue(treeStr == "<one> \t<two> \t </two> \n</one>")
def test_read_spacing(self): reader = StringIO.StringIO("<one> <two> </two> </one>") tree = wcdb_read(reader) treeStr = ET.tostring(tree) self.assertTrue(treeStr == "<one> <two> </two> </one>")
def test_read_2(self): reader = StringIO.StringIO("<a><b><c></c><d></d><e></e></b></a>") tree = wcdb_read(reader) treeStr = ET.tostring(tree) self.assertTrue(treeStr == "<a><b><c /><d /><e /></b></a>")
def test_read_1(self): reader = StringIO.StringIO( "<outer1><inner1></inner1><inner2></inner2></outer1>") tree = wcdb_read(reader) treeStr = ET.tostring(tree) self.assertTrue(treeStr == "<outer1><inner1 /><inner2 /></outer1>")
def test_read_6(self): r = io.StringIO("<one></one>") a = [''] b = wcdb_read(r, a) self.assertTrue(b == True) self.assertTrue(a[0] == '<one></one>')
def test_read_4(self): r = io.StringIO("<one>\t\t\t<two>\n\t\t</two></one>") a = [''] b = wcdb_read(r, a) self.assertTrue(b == True) self.assertTrue(a[0] == "<one><two></two></one>")
def test_read(self): r = io.StringIO("<Chocolate><Cake>Hello</Cake></Chocolate>") a = [''] b = wcdb_read(r, a) self.assertTrue(b == True) self.assertTrue(a[0] == "<Chocolate><Cake>Hello</Cake></Chocolate>")