File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff 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+ ]
You can’t perform that action at this time.
0 commit comments