ยปCore Development>Code coverage>Lib/test/test_msilib.py

Python code coverage for Lib/test/test_msilib.py

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