Commit afbae2d
Pin encode_value rejection of Decimal / Fraction / complex / custom
The wire codec accepts only bool / int / float / str / bytes / None.
Anything else hits the ``Cannot infer wire type`` branch in
``encode_value``. That rejection path was only exercised
incidentally, so a future refactor that added implicit Decimal or
numpy support (or accidentally accepted an object with __index__)
would slip through.
Add rejection tests for Decimal, Fraction, complex, plain object(),
and a class defining only __index__ (which is not an int subclass).
Tests intentionally do NOT include numpy — numpy is not a declared
dependency, and adding optional coverage risks flaky CI signal.
Integration-side tests in the dbapi package cover the corresponding
DataError bubbling.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 05d2bb7 commit afbae2d
1 file changed
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
0 commit comments