• Home
  • Raw
  • Download

Lines Matching +full:test +full:- +full:docs +full:- +full:mr

14 from test import support
15 from test.support import script_helper, ALWAYS_EQ
16 from test.support import gc_collect
17 from test.support import threading_helper
226 "reference object w/out callback should be re-used")
233 "reference object w/out callback should be re-used")
247 "proxy object w/out callback should have been re-used")
258 self.assertTrue(p, "proxy for non-empty UserList should be true")
313 return -163
319 self.assertEqual(5 @ p, -163)
398 # Test clearing of SF bug #762891
409 # Test clearing of SF bug #1170766
415 # Test fails with a debug build of the interpreter
416 # (see bpo-38395).
450 # bpo-44720: PyIter_Next() shouldn't be called if the reference
460 msg = "Weakref proxy referenced a non-iterator"
547 # Callbacks protected from already-set exceptions?
548 # Regression test for SF bug #478534.
573 # subtype_dealloc erroneously exposed a new-style instance
575 # causing double-deallocation if the instance had a weakref
604 # with c2 execute (there are none in this 2nd half of the test, btw).
625 # Now J and II are each in a self-cycle (as all new-style class
639 # tp_clear on J breaks its self-cycle, but J doesn't get deleted
642 # clear I.J first -- I.wr is still intact. That removes the last
644 # tries to do "self.J", and instances of new-style classes look up
654 # This one broke the first patch that fixed the previous test. In this case,
657 # c1 from c2, but not vice-versa. The result was that c2's __dict__
710 # to begin with -- the callback would act like an external root).
774 # -- which is itself a callback, and also part of the cyclic trash --
822 # non-existent memory. This test should not segfault the interpreter.
859 # Note how we directly test the operators here, to stress both
912 # - retain their hash is they were hashed when alive;
913 # - otherwise, cannot be hashed.
982 mr = MyRef(o, value=24)
983 self.assertIs(mr(), o)
984 self.assertTrue(mr.called)
985 self.assertEqual(mr.value, 24)
988 self.assertIsNone(mr())
989 self.assertTrue(mr.called)
1046 # Use a local callback, for "regrtest -R::"
1060 # Same test, with two weakrefs to the same object
1109 # Test callback behaviour when object dies first.
1125 # Test callback behaviour when method dies first.
1286 "cloning of weak-valued dictionary did not work!")
1291 self.assertEqual(len(dict), self.COUNT - 1,
1318 "cloning of weak-keyed dictionary did not work!")
1323 self.assertEqual(len(dict), (self.COUNT - 1),
1338 # Test keyrefs()
1350 # Test iterkeyrefs()
1365 # Test valuerefs()
1376 # Test itervaluerefs()
1417 del objects[-1]
1420 self.assertIn(len(list(it)), [len(objects), len(objects) - 1])
1423 self.assertEqual(len(dict), n - 1)
1455 # for this test to work properly)
1461 self.assertEqual(len(dict), n - 1)
1466 self.assertEqual(len(dict), n - 1)
1469 self.assertEqual(len(dict), n - 2)
1471 self.assertEqual(len(dict), n - 3)
1473 self.assertEqual(len(dict), n - 4)
1475 self.assertEqual(len(dict), n - 5)
1477 self.assertEqual(len(dict), n - 6)
1610 "invalid test"
1611 " -- value parameters must be distinct objects")
1800 del objs[-1]
1893 i = random.randint(0, len(lst) - 1)
1925 # Test exceptions
1959 from test import mapping_tests
1982 # we create no ref-cycles so in CPython no gc should be needed
2131 prog = ('from test.test_weakref import FinalizeTestCase;'+
2133 rc, out, err = script_helper.assert_python_ok('-c', prog)
2152 >>> from test.support import gc_collect
2193 >>> class A: # not in docs from here, just testing the ExtendedRef