(
self,
metadata,
connection,
produce_subject,
produce_table_integrated_subject,
produce_event_target,
)
| 408 | raise NotImplementedError() |
| 409 | |
| 410 | def test_table_integrated( |
| 411 | self, |
| 412 | metadata, |
| 413 | connection, |
| 414 | produce_subject, |
| 415 | produce_table_integrated_subject, |
| 416 | produce_event_target, |
| 417 | ): |
| 418 | subject = produce_subject |
| 419 | assert_subject = produce_event_target |
| 420 | |
| 421 | canary = mock.Mock() |
| 422 | event.listen(subject, "before_create", canary.before_create) |
| 423 | event.listen(subject, "after_create", canary.after_create) |
| 424 | event.listen(subject, "before_drop", canary.before_drop) |
| 425 | event.listen(subject, "after_drop", canary.after_drop) |
| 426 | |
| 427 | metadata.create_all(connection, checkfirst=False) |
| 428 | |
| 429 | if self.creates_implicitly_with_table: |
| 430 | create_calls = [] |
| 431 | else: |
| 432 | create_calls = [ |
| 433 | mock.call.before_create( |
| 434 | assert_subject, |
| 435 | connection, |
| 436 | _ddl_runner=mock.ANY, |
| 437 | ), |
| 438 | mock.call.after_create( |
| 439 | assert_subject, |
| 440 | connection, |
| 441 | _ddl_runner=mock.ANY, |
| 442 | ), |
| 443 | ] |
| 444 | eq_(canary.mock_calls, create_calls) |
| 445 | metadata.drop_all(connection, checkfirst=False) |
| 446 | |
| 447 | if self.drops_implicitly_with_table: |
| 448 | eq_(canary.mock_calls, create_calls + []) |
| 449 | else: |
| 450 | eq_( |
| 451 | canary.mock_calls, |
| 452 | create_calls |
| 453 | + [ |
| 454 | mock.call.before_drop( |
| 455 | assert_subject, |
| 456 | connection, |
| 457 | _ddl_runner=mock.ANY, |
| 458 | ), |
| 459 | mock.call.after_drop( |
| 460 | assert_subject, |
| 461 | connection, |
| 462 | _ddl_runner=mock.ANY, |
| 463 | ), |
| 464 | ], |
| 465 | ) |
| 466 | |
| 467 |
nothing calls this directly
no test coverage detected