def test_sup(self): expected_sel = p.Selection(span=[(1730, 1799)], gorn=[p.GornAddress([11, 2, 3])], text='blop blop split shares') expected = p.Sup(expected_sel) txt = ex_sup1 self.assertParse(p._sup('sup1'), expected, txt)
def test_selection(self): itm = p.Selection( span=[(36, 139)], gorn=[p.GornAddress([0, 1, 1]), p.GornAddress([2, 1])], text= 'federal thrift regulators ordered it to suspend dividend payments on its two classes of preferred stock' ) xml = x._Selection_xml(itm) self.assertEqual(itm, x._read_Selection(xml))
def test_selection(self): expected = p.Selection( span=[(36, 139)], gorn=[p.GornAddress([0, 1, 1]), p.GornAddress([2, 1])], text= 'federal thrift regulators ordered it to suspend dividend payments on its two classes of preferred stock' ) txt = ex_selection self.assertParse(p._selection, expected, txt)
def test_attribution_sel(self): expected_sel = p.Selection(span=[(9, 35)], gorn=[ p.GornAddress([0, 0]), p.GornAddress([0, 1, 0]), p.GornAddress([0, 1, 2]), p.GornAddress([0, 2]) ], text='CenTrust Savings Bank said') expected = p.Attribution('Ot', 'Comm', 'Null', 'Null', expected_sel) txt = ex_attribution2 self.assertParse(p._attributionFeatures, expected, txt)
def test_attribution(self): itm = p.Attribution('Ot', 'Comm', 'Null', 'Null') xml = x._Attribution_xml(itm) self.assertEqual(itm, x._read_Attribution(xml)) itm_sel = p.Selection(span=[(9, 35)], gorn=[ p.GornAddress([0, 0]), p.GornAddress([0, 1, 0]), p.GornAddress([0, 1, 2]), p.GornAddress([0, 2]) ], text='CenTrust Savings Bank said') itm = p.Attribution('Ot', 'Comm', 'Null', 'Null', itm_sel) xml = x._Attribution_xml(itm) self.assertEqual(itm, x._read_Attribution(xml))
def _read_Selection(node): attr = node.attrib return ty.Selection(span=_read_SpanList(attr['spanList']), gorn=_read_GornAddressList(attr['gornList']), text=on_single_element(node, None, lambda x: x.text, 'text'))