MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_getobj_getlock

Method test_getobj_getlock

Lib/test/_test_multiprocessing.py:2341–2364  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2339 self.test_value(raw=True)
2340
2341 def test_getobj_getlock(self):
2342 val1 = self.Value('i', 5)
2343 lock1 = val1.get_lock()
2344 obj1 = val1.get_obj()
2345
2346 val2 = self.Value('i', 5, lock=None)
2347 lock2 = val2.get_lock()
2348 obj2 = val2.get_obj()
2349
2350 lock = self.Lock()
2351 val3 = self.Value('i', 5, lock=lock)
2352 lock3 = val3.get_lock()
2353 obj3 = val3.get_obj()
2354 self.assertEqual(lock, lock3)
2355
2356 arr4 = self.Value('i', 5, lock=False)
2357 self.assertFalse(hasattr(arr4, 'get_lock'))
2358 self.assertFalse(hasattr(arr4, 'get_obj'))
2359
2360 self.assertRaises(AttributeError, self.Value, 'i', 5, lock='navalue')
2361
2362 arr5 = self.RawValue('i', 5)
2363 self.assertFalse(hasattr(arr5, 'get_lock'))
2364 self.assertFalse(hasattr(arr5, 'get_obj'))
2365
2366
2367class _TestArray(BaseTestCase):

Callers

nothing calls this directly

Calls 9

hasattrFunction · 0.85
ValueMethod · 0.80
get_lockMethod · 0.80
get_objMethod · 0.80
LockMethod · 0.80
assertFalseMethod · 0.80
RawValueMethod · 0.80
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected