Beispiel #1
0
 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')
Beispiel #2
0
 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)
Beispiel #3
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)
Beispiel #4
0
 def __init__(self):
     self.lnk = Lnk.chartspan(0, 1)