def explore(node): num = 1 seen_email.add(node.data["From"]) visited.add(node) content.append(clean_message(node.data["Body"])) if len(node.get_successors()) == 0: leaves.append(node) else: not_leaves.append(node) for s in node.get_successors(): if s not in visited: seen_email.add(s.data["From"]) num += explore(s) return num
def explore(node): num = 1 duration = 0 seen_email.add(node.data['From']) visited.add(node) content.append(clean_message(node.data['Body'])) if(len(node.get_successors()) == 0): leaves.append(node) else: not_leaves.append(node) for s in node.get_successors(): if(s not in visited): seen_email.add(s.data['From']) num += explore(s) return num
def test_clean_message(): name = "2001-November.txt" arx = archive.Archive(name,archive_dir="tests/data",mbox=True) body = arx.data['Body'][ '<*****@*****.**>'] assert "But seemingly it is even stranger than this." in body, \ "Selected wrong message" assert "Is it a problem of lapack3.0 of of" in body, \ "Quoted text is not in uncleaned message" assert "Is it a problem of lapack3.0 of of" not in utils.clean_message(body), \ "Quoted text is in cleaned message"
def test_clean_message(): name = "2001-November.txt" arx = archive.Archive(name, archive_dir="tests/data", mbox=True) body = arx.data['Body']['<*****@*****.**>'] assert "But seemingly it is even stranger than this." in body, \ "Selected wrong message" assert "Is it a problem of lapack3.0 of of" in body, \ "Quoted text is not in uncleaned message" assert "Is it a problem of lapack3.0 of of" not in utils.clean_message(body), \ "Quoted text is in cleaned message"
def explore(node): num = 1 duration = 0 seen_email.add(node.data['From']) visited.add(node) content.append(clean_message(node.data['Body'])) if (len(node.get_successors()) == 0): leaves.append(node) else: not_leaves.append(node) for s in node.get_successors(): if (s not in visited): seen_email.add(s.data['From']) num += explore(s) return num
def test_clean_message(self): name = "2001-November.txt" arx = archive.Archive(name, archive_dir=CONFIG.test_data_path, mbox=True) body = arx.data["Body"]["<*****@*****.**>"] self.assertTrue( "But seemingly it is even stranger than this." in body, msg="Selected wrong message", ) self.assertTrue( "Is it a problem of lapack3.0 of of" in body, msg="Quoted text is not in uncleaned message", ) self.assertTrue( "Is it a problem of lapack3.0 of of" not in utils.clean_message(body), msg="Quoted text is in cleaned message", )