Python sys.long_info() Examples

The following are 11 code examples of sys.long_info(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sys , or try the search function .
Example #1
Source File: test_sys.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def setUp(self):
        self.P = struct.calcsize('P')
        self.longdigit = sys.long_info.sizeof_digit
        import _testcapi
        self.gc_headsize = _testcapi.SIZEOF_PYGC_HEAD 
Example #2
Source File: test_sys.py    From BinderFilter with MIT License 5 votes vote down vote up
def setUp(self):
        self.P = struct.calcsize('P')
        self.longdigit = sys.long_info.sizeof_digit
        import _testcapi
        self.gc_headsize = _testcapi.SIZEOF_PYGC_HEAD
        self.file = open(test.test_support.TESTFN, 'wb') 
Example #3
Source File: test_sys.py    From oss-ftp with MIT License 5 votes vote down vote up
def setUp(self):
        self.P = struct.calcsize('P')
        self.longdigit = sys.long_info.sizeof_digit
        import _testcapi
        self.gc_headsize = _testcapi.SIZEOF_PYGC_HEAD
        self.file = open(test.test_support.TESTFN, 'wb') 
Example #4
Source File: minimalmodbus.py    From minimalmodbus with Apache License 2.0 5 votes vote down vote up
def _get_diagnostic_string():
    """Generate a diagnostic string, showing the module version, the platform etc.

    Returns:
        A descriptive string.

    """
    text = "\n## Diagnostic output from minimalmodbus ## \n\n"
    text += "Minimalmodbus version: " + __version__ + "\n"
    text += "Minimalmodbus status: " + __status__ + "\n"
    text += "File name (with relative path): " + __file__ + "\n"
    text += "Full file path: " + os.path.abspath(__file__) + "\n\n"
    text += "pySerial version: " + serial.VERSION + "\n"
    text += "pySerial full file path: " + os.path.abspath(serial.__file__) + "\n\n"
    text += "Platform: " + sys.platform + "\n"
    text += "Filesystem encoding: " + repr(sys.getfilesystemencoding()) + "\n"
    text += "Byteorder: " + sys.byteorder + "\n"
    text += "Python version: " + sys.version + "\n"
    text += "Python version info: " + repr(sys.version_info) + "\n"
    text += "Python flags: " + repr(sys.flags) + "\n"
    text += "Python argv: " + repr(sys.argv) + "\n"
    text += "Python prefix: " + repr(sys.prefix) + "\n"
    text += "Python exec prefix: " + repr(sys.exec_prefix) + "\n"
    text += "Python executable: " + repr(sys.executable) + "\n"
    try:
        text += "Long info: " + repr(sys.long_info) + "\n"
    except Exception:
        text += "Long info: (none)\n"  # For Python3 compatibility
    try:
        text += "Float repr style: " + repr(sys.float_repr_style) + "\n\n"
    except Exception:
        text += "Float repr style: (none) \n\n"  # For Python 2.6 compatibility
    text += "Variable __name__: " + __name__ + "\n"
    text += "Current directory: " + os.getcwd() + "\n\n"
    text += "Python path: \n"
    text += "\n".join(sys.path) + "\n"
    text += "\n## End of diagnostic output ## \n"
    return text


# For backward compatibility 
Example #5
Source File: test_sys.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setUp(self):
        self.P = struct.calcsize('P')
        self.longdigit = sys.long_info.sizeof_digit
        import _testcapi
        self.gc_headsize = _testcapi.SIZEOF_PYGC_HEAD
        self.file = open(test.test_support.TESTFN, 'wb') 
Example #6
Source File: test_sys_jy.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_long_info_tuple(self):
        self.assertEqual(tuple(sys.long_info), sys.long_info) 
Example #7
Source File: test_sys_jy.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_long_info_tuple(self):
        self.assertEqual(tuple(sys.long_info), sys.long_info) 
Example #8
Source File: test_sys.py    From ironpython2 with Apache License 2.0 4 votes vote down vote up
def test_attributes(self):
        self.assertIsInstance(sys.api_version, int)
        self.assertIsInstance(sys.argv, list)
        self.assertIn(sys.byteorder, ("little", "big"))
        self.assertIsInstance(sys.builtin_module_names, tuple)
        self.assertIsInstance(sys.copyright, basestring)
        self.assertIsInstance(sys.exec_prefix, basestring)
        self.assertIsInstance(sys.executable, basestring)
        self.assertEqual(len(sys.float_info), 11)
        self.assertEqual(sys.float_info.radix, 2)
        self.assertEqual(len(sys.long_info), 2)
        if sys.platform != 'cli':
            self.assertTrue(sys.long_info.bits_per_digit % 5 == 0)
        else:
            self.assertTrue(sys.long_info.bits_per_digit % 8 == 0)
        self.assertTrue(sys.long_info.sizeof_digit >= 1)
        self.assertEqual(type(sys.long_info.bits_per_digit), int)
        self.assertEqual(type(sys.long_info.sizeof_digit), int)
        self.assertIsInstance(sys.hexversion, int)
        self.assertIsInstance(sys.maxint, int)
        if test.test_support.have_unicode:
            self.assertIsInstance(sys.maxunicode, int)
        self.assertIsInstance(sys.platform, basestring)
        self.assertIsInstance(sys.prefix, basestring)
        self.assertIsInstance(sys.version, basestring)
        vi = sys.version_info
        self.assertIsInstance(vi[:], tuple)
        self.assertEqual(len(vi), 5)
        self.assertIsInstance(vi[0], int)
        self.assertIsInstance(vi[1], int)
        self.assertIsInstance(vi[2], int)
        self.assertIn(vi[3], ("alpha", "beta", "candidate", "final"))
        self.assertIsInstance(vi[4], int)
        self.assertIsInstance(vi.major, int)
        self.assertIsInstance(vi.minor, int)
        self.assertIsInstance(vi.micro, int)
        self.assertIn(vi.releaselevel, ("alpha", "beta", "candidate", "final"))
        self.assertIsInstance(vi.serial, int)
        self.assertEqual(vi[0], vi.major)
        self.assertEqual(vi[1], vi.minor)
        self.assertEqual(vi[2], vi.micro)
        self.assertEqual(vi[3], vi.releaselevel)
        self.assertEqual(vi[4], vi.serial)
        self.assertTrue(vi > (1,0,0))
        self.assertIsInstance(sys.float_repr_style, str)
        self.assertIn(sys.float_repr_style, ('short', 'legacy')) 
Example #9
Source File: test_sys.py    From BinderFilter with MIT License 4 votes vote down vote up
def test_attributes(self):
        self.assertIsInstance(sys.api_version, int)
        self.assertIsInstance(sys.argv, list)
        self.assertIn(sys.byteorder, ("little", "big"))
        self.assertIsInstance(sys.builtin_module_names, tuple)
        self.assertIsInstance(sys.copyright, basestring)
        self.assertIsInstance(sys.exec_prefix, basestring)
        self.assertIsInstance(sys.executable, basestring)
        self.assertEqual(len(sys.float_info), 11)
        self.assertEqual(sys.float_info.radix, 2)
        self.assertEqual(len(sys.long_info), 2)
        self.assertTrue(sys.long_info.bits_per_digit % 5 == 0)
        self.assertTrue(sys.long_info.sizeof_digit >= 1)
        self.assertEqual(type(sys.long_info.bits_per_digit), int)
        self.assertEqual(type(sys.long_info.sizeof_digit), int)
        self.assertIsInstance(sys.hexversion, int)
        self.assertIsInstance(sys.maxint, int)
        if test.test_support.have_unicode:
            self.assertIsInstance(sys.maxunicode, int)
        self.assertIsInstance(sys.platform, basestring)
        self.assertIsInstance(sys.prefix, basestring)
        self.assertIsInstance(sys.version, basestring)
        vi = sys.version_info
        self.assertIsInstance(vi[:], tuple)
        self.assertEqual(len(vi), 5)
        self.assertIsInstance(vi[0], int)
        self.assertIsInstance(vi[1], int)
        self.assertIsInstance(vi[2], int)
        self.assertIn(vi[3], ("alpha", "beta", "candidate", "final"))
        self.assertIsInstance(vi[4], int)
        self.assertIsInstance(vi.major, int)
        self.assertIsInstance(vi.minor, int)
        self.assertIsInstance(vi.micro, int)
        self.assertIn(vi.releaselevel, ("alpha", "beta", "candidate", "final"))
        self.assertIsInstance(vi.serial, int)
        self.assertEqual(vi[0], vi.major)
        self.assertEqual(vi[1], vi.minor)
        self.assertEqual(vi[2], vi.micro)
        self.assertEqual(vi[3], vi.releaselevel)
        self.assertEqual(vi[4], vi.serial)
        self.assertTrue(vi > (1,0,0))
        self.assertIsInstance(sys.float_repr_style, str)
        self.assertIn(sys.float_repr_style, ('short', 'legacy')) 
Example #10
Source File: test_sys.py    From oss-ftp with MIT License 4 votes vote down vote up
def test_attributes(self):
        self.assertIsInstance(sys.api_version, int)
        self.assertIsInstance(sys.argv, list)
        self.assertIn(sys.byteorder, ("little", "big"))
        self.assertIsInstance(sys.builtin_module_names, tuple)
        self.assertIsInstance(sys.copyright, basestring)
        self.assertIsInstance(sys.exec_prefix, basestring)
        self.assertIsInstance(sys.executable, basestring)
        self.assertEqual(len(sys.float_info), 11)
        self.assertEqual(sys.float_info.radix, 2)
        self.assertEqual(len(sys.long_info), 2)
        self.assertTrue(sys.long_info.bits_per_digit % 5 == 0)
        self.assertTrue(sys.long_info.sizeof_digit >= 1)
        self.assertEqual(type(sys.long_info.bits_per_digit), int)
        self.assertEqual(type(sys.long_info.sizeof_digit), int)
        self.assertIsInstance(sys.hexversion, int)
        self.assertIsInstance(sys.maxint, int)
        if test.test_support.have_unicode:
            self.assertIsInstance(sys.maxunicode, int)
        self.assertIsInstance(sys.platform, basestring)
        self.assertIsInstance(sys.prefix, basestring)
        self.assertIsInstance(sys.version, basestring)
        vi = sys.version_info
        self.assertIsInstance(vi[:], tuple)
        self.assertEqual(len(vi), 5)
        self.assertIsInstance(vi[0], int)
        self.assertIsInstance(vi[1], int)
        self.assertIsInstance(vi[2], int)
        self.assertIn(vi[3], ("alpha", "beta", "candidate", "final"))
        self.assertIsInstance(vi[4], int)
        self.assertIsInstance(vi.major, int)
        self.assertIsInstance(vi.minor, int)
        self.assertIsInstance(vi.micro, int)
        self.assertIn(vi.releaselevel, ("alpha", "beta", "candidate", "final"))
        self.assertIsInstance(vi.serial, int)
        self.assertEqual(vi[0], vi.major)
        self.assertEqual(vi[1], vi.minor)
        self.assertEqual(vi[2], vi.micro)
        self.assertEqual(vi[3], vi.releaselevel)
        self.assertEqual(vi[4], vi.serial)
        self.assertTrue(vi > (1,0,0))
        self.assertIsInstance(sys.float_repr_style, str)
        self.assertIn(sys.float_repr_style, ('short', 'legacy')) 
Example #11
Source File: test_sys.py    From gcblue with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def test_attributes(self):
        self.assertIsInstance(sys.api_version, int)
        self.assertIsInstance(sys.argv, list)
        self.assertIn(sys.byteorder, ("little", "big"))
        self.assertIsInstance(sys.builtin_module_names, tuple)
        self.assertIsInstance(sys.copyright, basestring)
        self.assertIsInstance(sys.exec_prefix, basestring)
        self.assertIsInstance(sys.executable, basestring)
        self.assertEqual(len(sys.float_info), 11)
        self.assertEqual(sys.float_info.radix, 2)
        self.assertEqual(len(sys.long_info), 2)
        self.assertTrue(sys.long_info.bits_per_digit % 5 == 0)
        self.assertTrue(sys.long_info.sizeof_digit >= 1)
        self.assertEqual(type(sys.long_info.bits_per_digit), int)
        self.assertEqual(type(sys.long_info.sizeof_digit), int)
        self.assertIsInstance(sys.hexversion, int)
        self.assertIsInstance(sys.maxint, int)
        if test.test_support.have_unicode:
            self.assertIsInstance(sys.maxunicode, int)
        self.assertIsInstance(sys.platform, basestring)
        self.assertIsInstance(sys.prefix, basestring)
        self.assertIsInstance(sys.version, basestring)
        vi = sys.version_info
        self.assertIsInstance(vi[:], tuple)
        self.assertEqual(len(vi), 5)
        self.assertIsInstance(vi[0], int)
        self.assertIsInstance(vi[1], int)
        self.assertIsInstance(vi[2], int)
        self.assertIn(vi[3], ("alpha", "beta", "candidate", "final"))
        self.assertIsInstance(vi[4], int)
        self.assertIsInstance(vi.major, int)
        self.assertIsInstance(vi.minor, int)
        self.assertIsInstance(vi.micro, int)
        self.assertIn(vi.releaselevel, ("alpha", "beta", "candidate", "final"))
        self.assertIsInstance(vi.serial, int)
        self.assertEqual(vi[0], vi.major)
        self.assertEqual(vi[1], vi.minor)
        self.assertEqual(vi[2], vi.micro)
        self.assertEqual(vi[3], vi.releaselevel)
        self.assertEqual(vi[4], vi.serial)
        self.assertTrue(vi > (1,0,0))
        self.assertIsInstance(sys.float_repr_style, str)
        self.assertIn(sys.float_repr_style, ('short', 'legacy'))