def test_FT_invalid_highlight_range(self): ft = FT('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (4, 24))) self.assertRaises(InvalidHighlightRange, ft.to_er7) ft = FT('HIGHLIGHTEDTEXTIMPORTANT', highlights=((4, 24), (0, 11))) self.assertRaises(InvalidHighlightRange, ft.to_er7) ft = FT('HIGHLIGHTEDTEXTIMPORTANT', highlights=((5, 11), (0, 11))) self.assertRaises(InvalidHighlightRange, ft.to_er7) ft = FT('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (0, 4))) self.assertRaises(InvalidHighlightRange, ft.to_er7)
def test_FT_highlights(self): ft = FT('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (18, 24))) self.assertEqual(ft.to_er7(), '\\H\\HIGHLIGHTED\\N\\TEXTIMP\\H\\ORTANT\\N\\')
def test_FT_subcomponent_escape(self): ft = FT('&subcomponent&') self.assertEqual(ft.to_er7(), '\\T\\subcomponent\\T\\')
def test_FT_repetition_escape(self): ft = FT('~repetition~') self.assertEqual(ft.to_er7(), '\\R\\repetition\\R\\')
def test_FT_field_escaping(self): ft = FT('|field|') self.assertEqual(ft.to_er7(), '\\F\\field\\F\\')
def test_FT_component_escape(self): ft = FT('^component^') self.assertEqual(ft.to_er7(), '\\S\\component\\S\\')
def test_FT_maxlength_strict(self): ft = 'a' * (FT(' ').max_length + 1) self.assertRaises(MaxLengthReached, FT, ft, validation_level=VALIDATION_LEVEL.STRICT)
def test_FT_maxlength(self): ft_str = 'a' * (FT(' ').max_length + 1) FT(ft_str) # no exception is raised here
def test_FT_highlights(self): ft = FT('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0,11), (18,24))) self.assertEqual(ft.to_er7(), '\\H\\HIGHLIGHTED\\N\\TEXTIMP\\H\\ORTANT\\N\\')
def test_FT(self): text = 'This is a FT datatype text' ft = FT(text) self.assertEqual(ft.classname, 'FT') self.assertEqual(ft.to_er7(), text)
def test_FT(self): text = 'This is a FT datatype text' ft = FT(text) self.assertEqual(ft.classname, ('FT')) self.assertEqual(ft.to_er7(), text)