diff options
| author | Benjamin Peterson <benjamin@python.org> | 2010-01-25 03:35:04 (GMT) |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2010-01-25 03:35:04 (GMT) |
| commit | 00b9051a7e28f13fccce409fa63f5cbdb49f280d (patch) | |
| tree | 4d8f265f9b49bf114083263c07a32e9084387f77 /Lib/test/test_platform.py | |
| parent | 7671709ec65979ea6e3b728b6dfecf6eec4d34a7 (diff) | |
| download | cpython-00b9051a7e28f13fccce409fa63f5cbdb49f280d.zip cpython-00b9051a7e28f13fccce409fa63f5cbdb49f280d.tar.gz cpython-00b9051a7e28f13fccce409fa63f5cbdb49f280d.tar.bz2 | |
Merged revisions 77735 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77735 | benjamin.peterson | 2010-01-24 21:31:13 -0600 (Sun, 24 Jan 2010) | 1 line
fix an UnboundLocalError when the release file is empty #7773
........
Diffstat (limited to 'Lib/test/test_platform.py')
| -rw-r--r-- | Lib/test/test_platform.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 9056d47..c3fd323 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -131,6 +131,24 @@ class PlatformTest(unittest.TestCase): executable = executable + '.exe' res = platform.libc_ver(sys.executable) + def test_parse_release_file(self): + + for input, output in ( + # Examples of release file contents: + ('SuSE Linux 9.3 (x86-64)', ('SuSE Linux ', '9.3', 'x86-64')), + ('SUSE LINUX 10.1 (X86-64)', ('SUSE LINUX ', '10.1', 'X86-64')), + ('SUSE LINUX 10.1 (i586)', ('SUSE LINUX ', '10.1', 'i586')), + ('Fedora Core release 5 (Bordeaux)', ('Fedora Core', '5', 'Bordeaux')), + ('Red Hat Linux release 8.0 (Psyche)', ('Red Hat Linux', '8.0', 'Psyche')), + ('Red Hat Linux release 9 (Shrike)', ('Red Hat Linux', '9', 'Shrike')), + ('Red Hat Enterprise Linux release 4 (Nahant)', ('Red Hat Enterprise Linux', '4', 'Nahant')), + ('CentOS release 4', ('CentOS', '4', None)), + ('Rocks release 4.2.1 (Cydonia)', ('Rocks', '4.2.1', 'Cydonia')), + ('', ('', '', '')), # If there's nothing there. + ): + self.assertEqual(platform._parse_release_file(input), output) + + def test_main(): test_support.run_unittest( PlatformTest |
