1 """ Test suite for the code in msilib """ 2 import unittest 3 import os 4 from test_support import run_unittest, import_module 5 msilib = import_module('msilib') 6 7 class Test_make_id(unittest.TestCase): 8 #http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx 9 """The Identifier data type is a text string. Identifiers may contain the 10 ASCII characters A-Z (a-z), digits, underscores (_), or periods (.). 11 However, every identifier must begin with either a letter or an 12 underscore. 13 """ 14 15 def test_is_no_change_required(self): 16 self.assertEqual( 17 msilib.make_id("short"), "short") 18 self.assertEqual( 19 msilib.make_id("nochangerequired"), "nochangerequired") 20 self.assertEqual( 21 msilib.make_id("one.dot"), "one.dot") 22 self.assertEqual( 23 msilib.make_id("_"), "_") 24 self.assertEqual( 25 msilib.make_id("a"), "a") 26 #self.assertEqual( 27 # msilib.make_id(""), "") 28 29 def test_invalid_first_char(self): 30 self.assertEqual( 31 msilib.make_id("9.short"), "_9.short") 32 self.assertEqual( 33 msilib.make_id(".short"), "_.short") 34 35 def test_invalid_any_char(self): 36 self.assertEqual( 37 msilib.make_id(".s\x82ort"), "_.s_ort") 38 self.assertEqual ( 39 msilib.make_id(".s\x82o?*+rt"), "_.s_o___rt") 40 41 42 def test_main(): 43 run_unittest(__name__) 44 45 if __name__ == '__main__': 46 test_main() 47