style: apply ruff format across backend + scripts (line-length 100)
Mechanical, whole-tree `ruff format` pass — no behaviour change. Recorded in .git-blame-ignore-revs (next commit) so git blame skips it.
This commit is contained in:
@@ -4,6 +4,7 @@ UPDATE statements against seeded rows (the migration itself is a no-op in the em
|
||||
|
||||
Uses the DB lane (`db` fixture) — skipped when no Postgres is reachable.
|
||||
"""
|
||||
|
||||
from sqlalchemy import text
|
||||
|
||||
from app.models import PlexLibrary, PlexShow
|
||||
@@ -30,15 +31,25 @@ def test_scalar_null_normalized_array_preserved(db):
|
||||
db.commit()
|
||||
# Set a pre-0.53.1 JSONB scalar null on one, a genuine array on the other.
|
||||
db.execute(text("UPDATE plex_shows SET genres = 'null'::jsonb WHERE rating_key = 'null_row'"))
|
||||
db.execute(text("""UPDATE plex_shows SET genres = '["Drama"]'::jsonb WHERE rating_key = 'array_row'"""))
|
||||
db.execute(
|
||||
text("""UPDATE plex_shows SET genres = '["Drama"]'::jsonb WHERE rating_key = 'array_row'""")
|
||||
)
|
||||
db.commit()
|
||||
assert db.scalar(text("SELECT jsonb_typeof(genres) FROM plex_shows WHERE rating_key='null_row'")) == "null"
|
||||
assert (
|
||||
db.scalar(text("SELECT jsonb_typeof(genres) FROM plex_shows WHERE rating_key='null_row'"))
|
||||
== "null"
|
||||
)
|
||||
|
||||
for stmt in _NORMALIZE:
|
||||
db.execute(text(stmt))
|
||||
db.commit()
|
||||
|
||||
# The scalar null is now SQL NULL (jsonb_typeof of SQL NULL is itself NULL, not 'null')...
|
||||
assert db.scalar(text("SELECT genres IS NULL FROM plex_shows WHERE rating_key='null_row'")) is True
|
||||
assert (
|
||||
db.scalar(text("SELECT genres IS NULL FROM plex_shows WHERE rating_key='null_row'")) is True
|
||||
)
|
||||
# ...and a real array is untouched.
|
||||
assert db.scalar(text("SELECT jsonb_typeof(genres) FROM plex_shows WHERE rating_key='array_row'")) == "array"
|
||||
assert (
|
||||
db.scalar(text("SELECT jsonb_typeof(genres) FROM plex_shows WHERE rating_key='array_row'"))
|
||||
== "array"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user