def testChartSpanLnk(self): lnk = Lnk.chartspan(0, 1) assert lnk.type == Lnk.CHARTSPAN assert lnk.data == (0, 1) assert str(lnk) == '<0#1>' repr(lnk) # no error lnk = Lnk.chartspan('0', '1') assert lnk.data == (0, 1) with pytest.raises(TypeError): Lnk.chartspan(1) with pytest.raises(TypeError): Lnk.chartspan([1, 2]) with pytest.raises(TypeError): Lnk.chartspan(1, 2, 3) with pytest.raises(ValueError): Lnk.chartspan('a', 'b')
def test__bool__(self): assert not Lnk(None) assert not Lnk.charspan(-1, -1) assert Lnk.charspan(0, 0) assert Lnk.chartspan(0, 0) assert Lnk.tokens([]) assert Lnk.edge(0)
def test__eq__(self): assert Lnk(None) == Lnk(None) assert Lnk(None) != Lnk.charspan(0, 1) assert Lnk.charspan(0, 1) == Lnk.charspan(0, 1) assert Lnk.charspan(0, 1) != Lnk.charspan(0, 2) assert Lnk.charspan(0, 1) != Lnk.chartspan(0, 1)
def __init__(self): self.lnk = Lnk.chartspan(0, 1)