Skip to content

Commit 165bc5f

Browse files
committed
test_extract_works_with_null_values, refs #423, #455
1 parent 365f625 commit 165bc5f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_extract.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,24 @@ def test_extract_error_on_incompatible_existing_lookup_table(fresh_db):
186186
fresh_db["species2"].insert({"id": 1, "common_name": 3.5})
187187
with pytest.raises(InvalidColumns):
188188
fresh_db["tree"].extract("common_name", table="species2")
189+
190+
191+
def test_extract_works_with_null_values(fresh_db):
192+
fresh_db["listens"].insert_all(
193+
[
194+
{"id": 1, "track_title": "foo", "album_title": "bar"},
195+
{"id": 2, "track_title": "baz", "album_title": None},
196+
],
197+
pk="id",
198+
)
199+
fresh_db["listens"].extract(
200+
columns=["album_title"], table="albums", fk_column="album_id"
201+
)
202+
assert list(fresh_db["listens"].rows) == [
203+
{"id": 1, "track_title": "foo", "album_id": 1},
204+
{"id": 2, "track_title": "baz", "album_id": 2},
205+
]
206+
assert list(fresh_db["albums"].rows) == [
207+
{"id": 1, "album_title": "bar"},
208+
{"id": 2, "album_title": None},
209+
]

0 commit comments

Comments
 (0)