Package bmrblib :: Package pystarlib :: Module TextTest
[hide private]
[frames] | no frames]

Source Code for Module bmrblib.pystarlib.TextTest

  1  from unittest import TestCase 
  2  import unittest 
  3  from bmrblib.pystarlib.Text import comments_strip 
  4   
  5   
6 -class AllChecks(TestCase):
7 - def test(self):
8 """Text""" 9 # textExpectedAfterCollapse = ';<eol-string>mmy xie<eol-string>;\n_Test' 10 # text = """; 11 #mmy xie 12 #; 13 #_Test""" 14 # textCollapsed = semicolon_block_collapse( text ) 15 # self.assertEqual( textExpectedAfterCollapse, textCollapsed) 16 # 17 # value, pos = tag_value_quoted_parse( textCollapsed, 0 ) 18 # valueExpected = '\nmmy xie\n' 19 # posExpected = 34 20 # self.assertEqual( valueExpected, value ) 21 # self.assertEqual( posExpected, pos) 22 23 t2 = """ 24 # comment 1 25 """ 26 t2noComment = """ 27 28 """ 29 self.assertEqual(t2noComment, comments_strip( t2 ))
30
31 - def testcomments_strip(self):
32 """comments_strip""" 33 text = """ 34 # my comment exactly 35 foo # comment 36 value#stil a value 37 bar 38 ; # actual data 39 ; 40 """ 41 textExpected = """ 42 43 foo 44 value#stil a value 45 bar 46 ; # actual data 47 ; 48 """ 49 textNew = comments_strip( text ) 50 self.assertEqual( textNew, textExpected)
51
52 - def testcomments_strip2(self):
53 """comments_strip 2""" 54 text = """ 55 H' # comment 56 H" # also 57 """ 58 textExpected = """ 59 H' 60 H" 61 """ 62 textNew = comments_strip( text ) 63 self.assertEqual( textNew, textExpected)
64
65 - def testcomments_strip3a(self):
66 """comments_strip 3a""" 67 text = """ 68 H# # comment 69 """ 70 textExpected = """ 71 H# 72 """ 73 74 textNew = comments_strip( text ) 75 self.assertEqual( textNew, textExpected)
76
77 - def testcomments_strip3(self):
78 """comments_strip 3""" 79 text = """ 80 H# 81 """ 82 textExpected = """ 83 H# 84 """ 85 86 textNew = comments_strip( text ) 87 self.assertEqual( textNew, textExpected)
88
89 - def testcomments_strip4(self):
90 """comments_strip 4""" 91 text = """ 92 ; 93 test1 # no comment 1 94 ; 95 ; 96 test2 # no comment 2 97 ; 98 """ 99 textExpected = """ 100 ; 101 test1 # no comment 1 102 ; 103 ; 104 test2 # no comment 2 105 ; 106 """ 107 textNew = comments_strip( text ) 108 self.assertEqual( textNew, textExpected)
109
110 - def testcomments_strip5(self):
111 """comments_strip 5""" 112 text = """ 113 'quoted value with embedded # comment' # real comment 114 """ 115 textExpected = """ 116 'quoted value with embedded # comment' 117 """ 118 textNew = comments_strip( text ) 119 self.assertEqual( textNew, textExpected)
120
121 - def testcomments_strip6(self):
122 """comments_strip 6""" 123 text = """ 124 "quoted value with embedded # comment" # real comment 125 """ 126 textExpected = """ 127 "quoted value with embedded # comment" 128 """ 129 textNew = comments_strip( text ) 130 self.assertEqual( textNew, textExpected)
131
132 - def testcomments_strip7(self):
133 """comments_strip 7""" 134 text = """ 135 "quoted 'complications ; ' with embedded # comment" # real comment 136 """ 137 textExpected = """ 138 "quoted 'complications ; ' with embedded # comment" 139 """ 140 textNew = comments_strip( text ) 141 self.assertEqual( textNew, textExpected)
142
143 - def testcomments_strip8(self):
144 """comments_strip 8""" 145 text = """ 146 "quoted 'complications;' with embedded # comment" # real comment 147 """ 148 textExpected = """ 149 "quoted 'complications;' with embedded # comment" 150 """ 151 textNew = comments_strip( text ) 152 self.assertEqual( textNew, textExpected)
153
154 - def testcomments_strip9(self):
155 """comments_strip 9""" 156 text = """ 157 ; 158 159 ; 160 """ 161 textExpected = """ 162 ; 163 164 ; 165 """ 166 textNew = comments_strip( text ) 167 self.assertEqual( textNew, textExpected)
168 169 if __name__ == "__main__": 170 unittest.main() 171