def test_Sortinfo_from_string(self): """ Initialise EventSortinfo or InstanceSortinfo as appropriate """ event_string = "e[tense=past]" self.assertEqual(Sortinfo.from_string(event_string), EventSortinfo.from_string(event_string)) instance_string = "x[num=pl]" self.assertEqual(Sortinfo.from_string(instance_string), InstanceSortinfo.from_string(instance_string))
def test_Sortinfo_subclasses_str(self): """ Strings of sortinfo objects should be of the form: cvarsort[feature1=value1, feature2=value2, ...] """ event = EventSortinfo('prop', 'past', 'indicative', '-', '-') event_string = 'e[sf=prop, tense=past, mood=indicative, perf=-, prog=-]' self.assertEqual(str(event), event_string) self.assertEqual(event, EventSortinfo.from_string(event_string)) instance = InstanceSortinfo('3', 'sg', 'f', '+', '+') instance_string = 'x[pers=3, num=sg, gend=f, ind=+, pt=+]' self.assertEqual(str(instance), instance_string) self.assertEqual(instance, InstanceSortinfo.from_string(instance_string))