load_only() propagates a ``"column:*"`` token within InstanceState.load_options.
(self)
| 838 | eq_(PathRegistry.deserialize(path.serialize()).path, path.path) |
| 839 | |
| 840 | def test_pickle_load_only(self): |
| 841 | """load_only() propagates a ``"column:*"`` token within |
| 842 | InstanceState.load_options.""" |
| 843 | |
| 844 | with fixture_session() as sess: |
| 845 | u1 = sess.scalars(select(User).options(load_only(User.name))).one() |
| 846 | sess.expunge_all() |
| 847 | |
| 848 | # prior to the #13493 fix, in a fresh interpreter this raised |
| 849 | # KeyError: 'column:*'; see |
| 850 | # test_unpickle_other_process() for that condition |
| 851 | u2 = pickle.loads(pickle.dumps(u1)) |
| 852 | |
| 853 | eq_( |
| 854 | [ |
| 855 | elem.path.path |
| 856 | for opt in u2._sa_instance_state.load_options |
| 857 | for elem in opt.context |
| 858 | ], |
| 859 | [ |
| 860 | (inspect(User), inspect(User).attrs.name), |
| 861 | (inspect(User), PathToken._intern["column:*"]), |
| 862 | ], |
| 863 | ) |
| 864 | |
| 865 | def test_pickle_wildcard_raiseload(self): |
| 866 | """raiseload("*") leaves a _LoadLazyAttribute in |
nothing calls this directly
no test coverage detected