OLD | NEW |
1 # -*- coding: iso-8859-1 -*- | 1 # -*- coding: iso-8859-1 -*- |
2 import unittest, test.test_support | 2 import unittest, test.test_support |
3 import sys, cStringIO, os | 3 import sys, cStringIO, os |
4 import struct | 4 import struct |
5 | 5 |
6 class SysModuleTest(unittest.TestCase): | 6 class SysModuleTest(unittest.TestCase): |
7 | 7 |
8 def test_original_displayhook(self): | 8 def test_original_displayhook(self): |
9 import __builtin__ | 9 import __builtin__ |
10 savestdout = sys.stdout | 10 savestdout = sys.stdout |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 # sys.floatinfo | 535 # sys.floatinfo |
536 check(sys.float_info, size(vh) + self.P * len(sys.float_info)) | 536 check(sys.float_info, size(vh) + self.P * len(sys.float_info)) |
537 # frame | 537 # frame |
538 import inspect | 538 import inspect |
539 CO_MAXBLOCKS = 20 | 539 CO_MAXBLOCKS = 20 |
540 x = inspect.currentframe() | 540 x = inspect.currentframe() |
541 ncells = len(x.f_code.co_cellvars) | 541 ncells = len(x.f_code.co_cellvars) |
542 nfrees = len(x.f_code.co_freevars) | 542 nfrees = len(x.f_code.co_freevars) |
543 extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\ | 543 extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\ |
544 ncells + nfrees - 1 | 544 ncells + nfrees - 1 |
545 check(x, size(vh + '12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) | 545 check(x, size(vh + '13P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) |
546 # function | 546 # function |
547 def func(): pass | 547 def func(): pass |
548 check(func, size(h + '9P')) | 548 check(func, size(h + '9P')) |
549 class c(): | 549 class c(): |
550 @staticmethod | 550 @staticmethod |
551 def foo(): | 551 def foo(): |
552 pass | 552 pass |
553 @classmethod | 553 @classmethod |
554 def bar(cls): | 554 def bar(cls): |
555 pass | 555 pass |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 check(sys.flags, size(vh) + self.P * len(sys.flags)) | 695 check(sys.flags, size(vh) + self.P * len(sys.flags)) |
696 | 696 |
697 | 697 |
698 def test_main(): | 698 def test_main(): |
699 test_classes = (SysModuleTest, SizeofTest) | 699 test_classes = (SysModuleTest, SizeofTest) |
700 | 700 |
701 test.test_support.run_unittest(*test_classes) | 701 test.test_support.run_unittest(*test_classes) |
702 | 702 |
703 if __name__ == "__main__": | 703 if __name__ == "__main__": |
704 test_main() | 704 test_main() |
OLD | NEW |