def test_add_icons(self): x = Xmrs() with pytest.raises(XmrsError): x.add_icons([('x0')]) # only left x.add_icons([('x0', 'topic')]) # only left and relation # hi, relation, and lo (the minimum, but probably max, too) x.add_icons([('x0', 'topic', 'x1')]) assert len(x.icons()) == 1 ics = x.icons('x0') assert len(ics) == 1 assert ics[0][0] == 'x0' assert ics[0][1] == 'topic' assert ics[0][2] == 'x1' # can have more than one icons with the same left variable x.add_icons([('x0', 'focus', 'x2')]) assert len(x.icons()) == 2
def test_empty(self): x = Xmrs() assert x.top is None assert x.index is None assert x.xarg is None assert len(x.eps()) == 0 assert len(x.hcons()) == 0 assert len(x.icons()) == 0 assert len(x.variables()) == 0
def test_empty(self): x = Xmrs() assert x.top is None assert x.index is None assert x.xarg is None assert len(x.nodeids()) == 0 assert len(x.eps()) == 0 assert len(x.hcons()) == 0 assert len(x.icons()) == 0 assert len(x.variables()) == 0
def test_icons(self): x = Xmrs() with pytest.raises(KeyError): x.icons(left='x5') assert len(x.icons()) == 0 x.add_icons([('e2', 'topic', 'e5')]) ics = x.icons() assert len(ics) == 1 assert ics[0] == ('e2', 'topic', 'e5') x.add_icons([('e2', 'focus', 'x4'), ('x7', 'info-str', 'x9')]) ics = x.icons(left='e2') # icons are not stored sorted assert len(ics) == 2 assert set(ics) == {('e2', 'topic', 'e5'), ('e2', 'focus', 'x4')} with pytest.raises(KeyError): assert len(x.icons(left='e5')) == 0 with pytest.raises(KeyError): assert len(x.icons(left='x4')) == 0 with pytest.raises(KeyError): assert len(x.icons(left='x9')) == 0 assert len(x.icons(left='x7')) == 1
def test_icons(self): x = Xmrs() with pytest.raises(KeyError): x.icons(left='x5') assert len(x.icons()) == 0 x.add_icons([('e2', 'topic', 'e5')]) ics = x.icons() assert len(ics) == 1 assert ics[0] == ('e2', 'topic', 'e5') x.add_icons([('e2', 'focus', 'x4'), ('x7', 'info-str', 'x9')]) ics = x.icons(left='e2') # icons are not stored sorted assert len(ics) == 2 assert set(ics) == {('e2', 'topic', 'e5'), ('e2', 'focus', 'x4')} with pytest.raises(KeyError): assert len(x.icons(left='e5')) == 0 assert len(x.icons(left='x4')) == 0 assert len(x.icons(left='x9')) == 0 assert len(x.icons(left='x7')) == 1