Update value-mapping accepts tests for json/jsonb support

Two unit tests still asserted that `json` is rejected by the value mapping,
which became stale when json/jsonb decode and encode were added:
`accepts_lists_match_supported_types` now checks json/jsonb are accepted by
both `ToSql` and the Python decoder (while remaining outside the shared scalar
list), and `from_sql_rejects_unsupported_column_type` uses `uuid` as its
genuinely-unsupported type.

Full `cargo test` is green again (157 passed); caught by a full-suite run after
filtered runs had missed it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3G4M92AmwSSZCbmtMJU3d
This commit is contained in:
Erik Johnston
2026-07-11 09:06:48 +00:00
co-authored by Claude Opus 4.8
parent bcf5c4c4aa
commit 4a1fd28090
+13 -2
View File
@@ -890,7 +890,18 @@ mod tests {
);
}
for ty in [Type::JSON, Type::TIMESTAMPTZ, Type::UUID] {
// `json`/`jsonb`/`jsonpath` are additionally accepted by both the
// Python decoder and `ToSql` (see their `accepts` overrides), but not
// by the shared scalar list.
for ty in [Type::JSON, Type::JSONB] {
assert!(<PgValue as ToSql>::accepts(&ty), "ToSql should accept {ty}");
assert!(
<PythonPgFromSql as tokio_postgres::types::FromSql>::accepts(&ty),
"FromSql should accept {ty}"
);
}
for ty in [Type::TIMESTAMPTZ, Type::UUID] {
assert!(
!<PgValue as ToSql>::accepts(&ty),
"ToSql should reject {ty}"
@@ -956,7 +967,7 @@ mod tests {
// out of sync; decoding an unsupported type is an error, not a panic.
Python::initialize();
Python::attach(|_py| {
assert!(PythonPgFromSql::from_sql(&Type::JSON, b"{}").is_err());
assert!(PythonPgFromSql::from_sql(&Type::UUID, b"0123456789abcdef").is_err());
});
}