Trees | Indices | Help |
|
---|
|
1 from unittest import TestCase 2 import unittest 3 from bmrblib.pystarlib.Text import comments_strip 4 5168 169 if __name__ == "__main__": 170 unittest.main() 1718 """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 ))3032 """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)5153 """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)6466 """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)7678 """comments_strip 3""" 79 text = """ 80 H# 81 """ 82 textExpected = """ 83 H# 84 """ 85 86 textNew = comments_strip( text ) 87 self.assertEqual( textNew, textExpected)8890 """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)109111 """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)120122 """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)131133 """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)142144 """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)153155 """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)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Nov 26 19:05:18 2013 | http://epydoc.sourceforge.net |