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 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 _read_GornAddressList(attr): return [ ty.GornAddress([int(y) for y in x.split(',')]) for x in attr.split(';') ]
def test_gorn(self): itm = p.GornAddress([4, 3, 2]) xml = x._GornAddress_xml(itm) self.assertEqual([itm], x._read_GornAddressList(xml))
def test_gorn(self): expected = p.GornAddress([0, 1, 5, 3]) txt = ','.join(str(x) for x in expected.parts) self.assertParse(p._gorn, expected, txt)