diff options
Diffstat (limited to 'lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/test_runtime.py')
-rwxr-xr-x | lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/test_runtime.py | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/test_runtime.py b/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/test_runtime.py deleted file mode 100755 index 4c94fb5e..00000000 --- a/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/test_runtime.py +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright (c) Twisted Matrix Laboratories. -# See LICENSE for details. - -""" -Tests for runtime checks. -""" - -import sys - -from twisted.python.runtime import Platform, shortPythonVersion -from twisted.trial.unittest import TestCase - - - -class PythonVersionTests(TestCase): - """ - Tests the shortPythonVersion method. - """ - - def test_shortPythonVersion(self): - """ - Verify if the Python version is returned correctly. - """ - ver = shortPythonVersion().split('.') - for i in range(3): - self.assertEqual(int(ver[i]), sys.version_info[i]) - - - -class PlatformTests(TestCase): - """ - Tests for the default L{Platform} initializer. - """ - - def test_isVistaConsistency(self): - """ - Verify consistency of L{Platform.isVista}: it can only be C{True} if - L{Platform.isWinNT} and L{Platform.isWindows} are C{True}. - """ - platform = Platform() - if platform.isVista(): - self.assertTrue(platform.isWinNT()) - self.assertTrue(platform.isWindows()) - self.assertFalse(platform.isMacOSX()) - - - def test_isMacOSXConsistency(self): - """ - L{Platform.isMacOSX} can only return C{True} if L{Platform.getType} - returns C{'posix'}. - """ - platform = Platform() - if platform.isMacOSX(): - self.assertEqual(platform.getType(), 'posix') - - - def test_isLinuxConsistency(self): - """ - L{Platform.isLinux} can only return C{True} if L{Platform.getType} - returns C{'posix'} and L{sys.platform} starts with C{"linux"}. - """ - platform = Platform() - if platform.isLinux(): - self.assertTrue(sys.platform.startswith("linux")) - - - -class ForeignPlatformTests(TestCase): - """ - Tests for L{Platform} based overridden initializer values. - """ - - def test_getType(self): - """ - If an operating system name is supplied to L{Platform}'s initializer, - L{Platform.getType} returns the platform type which corresponds to that - name. - """ - self.assertEqual(Platform('nt').getType(), 'win32') - self.assertEqual(Platform('ce').getType(), 'win32') - self.assertEqual(Platform('posix').getType(), 'posix') - self.assertEqual(Platform('java').getType(), 'java') - - - def test_isMacOSX(self): - """ - If a system platform name is supplied to L{Platform}'s initializer, it - is used to determine the result of L{Platform.isMacOSX}, which returns - C{True} for C{"darwin"}, C{False} otherwise. - """ - self.assertTrue(Platform(None, 'darwin').isMacOSX()) - self.assertFalse(Platform(None, 'linux2').isMacOSX()) - self.assertFalse(Platform(None, 'win32').isMacOSX()) - - - def test_isLinux(self): - """ - If a system platform name is supplied to L{Platform}'s initializer, it - is used to determine the result of L{Platform.isLinux}, which returns - C{True} for values beginning with C{"linux"}, C{False} otherwise. - """ - self.assertFalse(Platform(None, 'darwin').isLinux()) - self.assertTrue(Platform(None, 'linux').isLinux()) - self.assertTrue(Platform(None, 'linux2').isLinux()) - self.assertTrue(Platform(None, 'linux3').isLinux()) - self.assertFalse(Platform(None, 'win32').isLinux()) |