Example #1
0
 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)
Example #2
0
 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\\')
Example #3
0
 def test_TX_subcomponent_escape(self):
     tx = TX('&subcomponent&')
     self.assertEqual(tx.to_er7(), '\\T\\subcomponent\\T\\')
Example #4
0
 def test_TX_repetition_escape(self):
     tx = TX('~repetition~')
     self.assertEqual(tx.to_er7(), '\\R\\repetition\\R\\')
Example #5
0
 def test_TX_field_escaping(self):
     tx = TX('|field|')
     self.assertEqual(tx.to_er7(), '\\F\\field\\F\\')
Example #6
0
 def test_TX_component_escape(self):
     tx = TX('^component^')
     self.assertEqual(tx.to_er7(), '\\S\\component\\S\\')
Example #7
0
 def test_TX_maxlength_strict(self):
     tx = 'a' * (TX(' ').max_length + 1)
     self.assertRaises(MaxLengthReached,
                       TX,
                       tx,
                       validation_level=VALIDATION_LEVEL.STRICT)
Example #8
0
 def test_TX_maxlength(self):
     tx_str = 'a' * (TX(' ').max_length + 1)
     TX(tx_str)
Example #9
0
 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\\')
Example #10
0
 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)
Example #11
0
 def test_TX_repetition_escape(self):
     tx = TX('~repetition~')
     self.assertEqual(tx.to_er7(), '\\R\\repetition\\R\\')
Example #12
0
 def test_TX_subcomponent_escape(self):
     tx = TX('&subcomponent&')
     self.assertEqual(tx.to_er7(), '\\T\\subcomponent\\T\\')
Example #13
0
 def test_TX_component_escape(self):
     tx = TX('^component^')
     self.assertEqual(tx.to_er7(), '\\S\\component\\S\\')
Example #14
0
 def test_TX_field_escaping(self):
     tx = TX('|field|')
     self.assertEqual(tx.to_er7(), '\\F\\field\\F\\')
Example #15
0
 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)