Пример #1
0
 def test_unicode(self):
     """A non-ascii variable is returned as unicode"""
     unicode_val = u"\xa7" # non-ascii character present in many encodings
     try:
         bytes_val = unicode_val.encode(osutils.get_user_encoding())
     except UnicodeEncodeError:
         self.skip("Couldn't encode non-ascii string to place in environ")
     os.environ["TEST"] = bytes_val
     self.assertEqual(unicode_val, win32utils.get_environ_unicode("TEST"))
Пример #2
0
 def test_unicode(self):
     """A non-ascii variable is returned as unicode"""
     unicode_val = u"\xa7" # non-ascii character present in many encodings
     try:
         bytes_val = unicode_val.encode(osutils.get_user_encoding())
     except UnicodeEncodeError:
         self.skip("Couldn't encode non-ascii string to place in environ")
     os.environ["TEST"] = bytes_val
     self.assertEqual(unicode_val, win32utils.get_environ_unicode("TEST"))
Пример #3
0
 def test_long(self):
     """A variable bigger than heuristic buffer size is still accessible"""
     big_val = "x" * (2<<10)
     os.environ["TEST"] = big_val
     self.assertEqual(big_val, win32utils.get_environ_unicode("TEST"))
Пример #4
0
 def test_unset_default(self):
     """A variable not present in the environment gives passed default"""
     del os.environ["TEST"]
     self.assertIs("a", win32utils.get_environ_unicode("TEST", "a"))
Пример #5
0
 def test_unset(self):
     """A variable not present in the environment gives None by default"""
     del os.environ["TEST"]
     self.assertIs(None, win32utils.get_environ_unicode("TEST"))
Пример #6
0
 def test_get(self):
     """In the normal case behaves the same as os.environ access"""
     self.assertEqual("1", win32utils.get_environ_unicode("TEST"))
Пример #7
0
 def test_long(self):
     """A variable bigger than heuristic buffer size is still accessible"""
     big_val = "x" * (2<<10)
     os.environ["TEST"] = big_val
     self.assertEqual(big_val, win32utils.get_environ_unicode("TEST"))
Пример #8
0
 def test_unset_default(self):
     """A variable not present in the environment gives passed default"""
     del os.environ["TEST"]
     self.assertIs("a", win32utils.get_environ_unicode("TEST", "a"))
Пример #9
0
 def test_unset(self):
     """A variable not present in the environment gives None by default"""
     del os.environ["TEST"]
     self.assertIs(None, win32utils.get_environ_unicode("TEST"))
Пример #10
0
 def test_get(self):
     """In the normal case behaves the same as os.environ access"""
     self.assertEqual("1", win32utils.get_environ_unicode("TEST"))