Store Path._directions as a JSON array
The column is of type `JSON`, but the code stored a JSON-encoded string in it; so, the data was encoded twice. A later data migration converts the existing rows.
This commit is contained in:
parent
2b1dd6af35
commit
bbd7d6a279
1 changed files with 7 additions and 12 deletions
|
|
@ -1,7 +1,5 @@
|
|||
"""Test the ORM's `Path` model."""
|
||||
|
||||
import json
|
||||
|
||||
import googlemaps as gm
|
||||
import pytest
|
||||
import sqlalchemy as sa
|
||||
|
|
@ -28,12 +26,10 @@ def path(address, another_address, make_address):
|
|||
|
||||
# We put 5 latitude-longitude pairs as the "path" from
|
||||
# `.first_address` to `.second_address`.
|
||||
directions = json.dumps(
|
||||
[
|
||||
(float(add.latitude), float(add.longitude))
|
||||
for add in (make_address() for _ in range(5))
|
||||
],
|
||||
)
|
||||
directions = [
|
||||
[float(add.latitude), float(add.longitude)]
|
||||
for add in (make_address() for _ in range(5))
|
||||
]
|
||||
|
||||
return db.Path(
|
||||
first_address=address,
|
||||
|
|
|
|||
Loading…
Reference in a new issue