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