def test_ID_invalid_highlight_range(self): i = ID('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (4, 24))) self.assertRaises(InvalidHighlightRange, i.to_er7) i = ID('HIGHLIGHTEDTEXTIMPORTANT', highlights=((4, 24), (0, 11))) self.assertRaises(InvalidHighlightRange, i.to_er7) i = ID('HIGHLIGHTEDTEXTIMPORTANT', highlights=((5, 11), (0, 11))) self.assertRaises(InvalidHighlightRange, i.to_er7) i = ID('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (0, 4))) self.assertRaises(InvalidHighlightRange, i.to_er7)
def test_ID_highlights(self): i = ID('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (18, 24))) self.assertEqual(i.to_er7(), '\\H\\HIGHLIGHTED\\N\\TEXTIMP\\H\\ORTANT\\N\\')
def test_ID_subcomponent_escape(self): i = ID('&subcomponent&') self.assertEqual(i.to_er7(), '\\T\\subcomponent\\T\\')
def test_ID_repetition_escape(self): i = ID('~repetition~') self.assertEqual(i.to_er7(), '\\R\\repetition\\R\\')
def test_ID_field_escaping(self): i = ID('|field|') self.assertEqual(i.to_er7(), '\\F\\field\\F\\')
def test_ID_component_escape(self): i = ID('^component^') self.assertEqual(i.to_er7(), '\\S\\component\\S\\')
def test_ID(self): id_str = 'This is a ID' id = ID(id_str) self.assertEqual(id.classname, ('ID')) self.assertEqual(id.to_er7(), id_str)
def test_ID(self): id_str = 'This is a ID' i = ID(id_str) self.assertEqual(i.classname, 'ID') self.assertEqual(i.to_er7(), id_str)