()
| 364 | |
| 365 | |
| 366 | def test_SerializableLock(): |
| 367 | a = SerializableLock() |
| 368 | b = SerializableLock() |
| 369 | with a: |
| 370 | pass |
| 371 | |
| 372 | with a: |
| 373 | with b: |
| 374 | pass |
| 375 | |
| 376 | with a: |
| 377 | assert not a.acquire(False) |
| 378 | |
| 379 | a2 = pickle.loads(pickle.dumps(a)) |
| 380 | a3 = pickle.loads(pickle.dumps(a)) |
| 381 | a4 = pickle.loads(pickle.dumps(a2)) |
| 382 | |
| 383 | for x in [a, a2, a3, a4]: |
| 384 | for y in [a, a2, a3, a4]: |
| 385 | with x: |
| 386 | assert not y.acquire(False) |
| 387 | |
| 388 | b2 = pickle.loads(pickle.dumps(b)) |
| 389 | b3 = pickle.loads(pickle.dumps(b2)) |
| 390 | |
| 391 | for x in [a, a2, a3, a4]: |
| 392 | for y in [b, b2, b3]: |
| 393 | with x: |
| 394 | with y: |
| 395 | pass |
| 396 | with y: |
| 397 | with x: |
| 398 | pass |
| 399 | |
| 400 | |
| 401 | def test_SerializableLock_name_collision(): |
nothing calls this directly
no test coverage detected