示例#1
0
 def test_GTS_invalid_highlight_range(self):
     gts = GTS('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (4, 24)))
     self.assertRaises(InvalidHighlightRange, gts.to_er7)
     gts = GTS('HIGHLIGHTEDTEXTIMPORTANT', highlights=((4, 24), (0, 11)))
     self.assertRaises(InvalidHighlightRange, gts.to_er7)
     gts = GTS('HIGHLIGHTEDTEXTIMPORTANT', highlights=((5, 11), (0, 11)))
     self.assertRaises(InvalidHighlightRange, gts.to_er7)
     gts = GTS('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (0, 4)))
     self.assertRaises(InvalidHighlightRange, gts.to_er7)
示例#2
0
 def test_GTS_highlights(self):
     gts = GTS('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0, 11), (18, 24)))
     self.assertEqual(gts.to_er7(),
                      '\\H\\HIGHLIGHTED\\N\\TEXTIMP\\H\\ORTANT\\N\\')
示例#3
0
 def test_GTS_subcomponent_escape(self):
     gts = GTS('&subcomponent&')
     self.assertEqual(gts.to_er7(), '\\T\\subcomponent\\T\\')
示例#4
0
 def test_GTS_repetition_escape(self):
     gts = GTS('~repetition~')
     self.assertEqual(gts.to_er7(), '\\R\\repetition\\R\\')
示例#5
0
 def test_GTS_field_escaping(self):
     gts = GTS('|field|')
     self.assertEqual(gts.to_er7(), '\\F\\field\\F\\')
示例#6
0
 def test_GTS_component_escape(self):
     gts = GTS('^component^')
     self.assertEqual(gts.to_er7(), '\\S\\component\\S\\')
示例#7
0
 def test_GTS_maxlength_strict(self):
     gts = 'a' * (GTS(' ').max_length + 1)
     self.assertRaises(MaxLengthReached,
                       GTS,
                       gts,
                       validation_level=VALIDATION_LEVEL.STRICT)
示例#8
0
 def test_GTS_maxlength(self):
     gts_str = 'a' * (GTS(' ').max_length + 1)
     GTS(gts_str)
示例#9
0
 def test_GTS_highlights(self):
     gts = GTS('HIGHLIGHTEDTEXTIMPORTANT', highlights=((0,11), (18,24)))
     self.assertEqual(gts.to_er7(), '\\H\\HIGHLIGHTED\\N\\TEXTIMP\\H\\ORTANT\\N\\')
示例#10
0
 def test_GTS(self):
     text = 'This is a GTS datatype text'
     gts = GTS(text)
     self.assertEqual(gts.classname, 'GTS')
     self.assertEqual(gts.to_er7(), text)
示例#11
0
 def test_GTS_repetition_escape(self):
     gts = GTS('~repetition~')
     self.assertEqual(gts.to_er7(), '\\R\\repetition\\R\\')
示例#12
0
 def test_GTS_subcomponent_escape(self):
     gts = GTS('&subcomponent&')
     self.assertEqual(gts.to_er7(), '\\T\\subcomponent\\T\\')
示例#13
0
 def test_GTS_component_escape(self):
     gts = GTS('^component^')
     self.assertEqual(gts.to_er7(), '\\S\\component\\S\\')
示例#14
0
 def test_GTS_field_escaping(self):
     gts = GTS('|field|')
     self.assertEqual(gts.to_er7(), '\\F\\field\\F\\')
示例#15
0
 def test_GTS(self):
     text = 'This is a GTS datatype text'
     gts = GTS(text)
     self.assertEqual(gts.classname, 'GTS')
     self.assertEqual(gts.to_er7(), text)