def test_TX_invalid_highlight_range(self): tx = TX('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (4, 24))) self.assertRaises(InvalidHighlightRange, tx.to_er7) tx = TX('HIGHLIGHTEDTEXTIMPORTANT', highlights=((4, 24), (0, 11))) self.assertRaises(InvalidHighlightRange, tx.to_er7) tx = TX('HIGHLIGHTEDTEXTIMPORTANT', highlights=((5, 11), (0, 11))) self.assertRaises(InvalidHighlightRange, tx.to_er7) tx = TX('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (0, 4))) self.assertRaises(InvalidHighlightRange, tx.to_er7)
def test_TX_highlights(self): tx = TX('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (18, 24))) self.assertEqual(tx.to_er7(), '\\H\\HIGHLIGHTED\\N\\TEXTIMP\\H\\ORTANT\\N\\')
def test_TX_subcomponent_escape(self): tx = TX('&subcomponent&') self.assertEqual(tx.to_er7(), '\\T\\subcomponent\\T\\')
def test_TX_repetition_escape(self): tx = TX('~repetition~') self.assertEqual(tx.to_er7(), '\\R\\repetition\\R\\')
def test_TX_field_escaping(self): tx = TX('|field|') self.assertEqual(tx.to_er7(), '\\F\\field\\F\\')
def test_TX_component_escape(self): tx = TX('^component^') self.assertEqual(tx.to_er7(), '\\S\\component\\S\\')
def test_TX_maxlength_strict(self): tx = 'a' * (TX(' ').max_length + 1) self.assertRaises(MaxLengthReached, TX, tx, validation_level=VALIDATION_LEVEL.STRICT)
def test_TX_maxlength(self): tx_str = 'a' * (TX(' ').max_length + 1) TX(tx_str)
def test_TX_highlights(self): tx = TX('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0,11), (18,24))) self.assertEqual(tx.to_er7(), '\\H\\HIGHLIGHTED\\N\\TEXTIMP\\H\\ORTANT\\N\\')
def test_TX(self): text = 'This is a TX datatype text' tx = TX(text) self.assertEqual(tx.classname, 'TX') self.assertEqual(tx.to_er7(), text)
def test_TX(self): text = 'This is a TX datatype text' tx = TX(text) self.assertEqual(tx.classname, ('TX')) self.assertEqual(tx.to_er7(), text)