OLD | NEW |
1 import types | 1 import types |
2 import unittest | 2 import unittest |
3 import warnings | 3 import warnings |
4 | 4 |
5 from copy import deepcopy | 5 from copy import deepcopy |
6 from test import support | 6 from test import support |
7 | 7 |
8 | 8 |
9 class OperatorsTest(unittest.TestCase): | 9 class OperatorsTest(unittest.TestCase): |
10 | 10 |
(...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2598 for op in "<", "<=", "==", "!=", ">", ">=": | 2598 for op in "<", "<=", "==", "!=", ">", ">=": |
2599 self.assert_(eval("c[x] %s c[y]" % op) == eval("x %s y"
% op), | 2599 self.assert_(eval("c[x] %s c[y]" % op) == eval("x %s y"
% op), |
2600 "x=%d, y=%d" % (x, y)) | 2600 "x=%d, y=%d" % (x, y)) |
2601 self.assert_(eval("c[x] %s y" % op) == eval("x %s y" % o
p), | 2601 self.assert_(eval("c[x] %s y" % op) == eval("x %s y" % o
p), |
2602 "x=%d, y=%d" % (x, y)) | 2602 "x=%d, y=%d" % (x, y)) |
2603 self.assert_(eval("x %s c[y]" % op) == eval("x %s y" % o
p), | 2603 self.assert_(eval("x %s c[y]" % op) == eval("x %s y" % o
p), |
2604 "x=%d, y=%d" % (x, y)) | 2604 "x=%d, y=%d" % (x, y)) |
2605 | 2605 |
2606 def test_descrdoc(self): | 2606 def test_descrdoc(self): |
2607 # Testing descriptor doc strings... | 2607 # Testing descriptor doc strings... |
2608 from _fileio import _FileIO | 2608 from _io import FileIO |
2609 def check(descr, what): | 2609 def check(descr, what): |
2610 self.assertEqual(descr.__doc__, what) | 2610 self.assertEqual(descr.__doc__, what) |
2611 check(_FileIO.closed, "True if the file is closed") # getset descriptor | 2611 check(FileIO.closed, "True if the file is closed") # getset descriptor |
2612 check(complex.real, "the real part of a complex number") # member descri
ptor | 2612 check(complex.real, "the real part of a complex number") # member descri
ptor |
2613 | 2613 |
2614 def test_doc_descriptor(self): | 2614 def test_doc_descriptor(self): |
2615 # Testing __doc__ descriptor... | 2615 # Testing __doc__ descriptor... |
2616 # SF bug 542984 | 2616 # SF bug 542984 |
2617 class DocDescr(object): | 2617 class DocDescr(object): |
2618 def __get__(self, object, otype): | 2618 def __get__(self, object, otype): |
2619 if object: | 2619 if object: |
2620 object = object.__class__.__name__ + ' instance' | 2620 object = object.__class__.__name__ + ' instance' |
2621 if otype: | 2621 if otype: |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4076 type.mro(tuple) | 4076 type.mro(tuple) |
4077 | 4077 |
4078 | 4078 |
4079 def test_main(): | 4079 def test_main(): |
4080 # Run all local test cases, with PTypesLongInitTest first. | 4080 # Run all local test cases, with PTypesLongInitTest first. |
4081 support.run_unittest(PTypesLongInitTest, OperatorsTest, | 4081 support.run_unittest(PTypesLongInitTest, OperatorsTest, |
4082 ClassPropertiesAndMethods, DictProxyTests) | 4082 ClassPropertiesAndMethods, DictProxyTests) |
4083 | 4083 |
4084 if __name__ == "__main__": | 4084 if __name__ == "__main__": |
4085 test_main() | 4085 test_main() |
OLD | NEW |