#NEWLINE# def test_extract( self ) : #NEWLINE# #INDENT# titles = self . Q . select ( APIData . data . extract ( 'title' ) ) . tuples ( ) #NEWLINE# self . assertEqual ( [ row for ( row , ) in titles ] , [ 'My List of Python and SQLite Resources' , "Using SQLite4's LSM Storage Engine as a Stand-alone NoSQL Database with Python" , 'Building the SQLite FTS5 Search Extension' , 'Introduction to the fast new UnQLite Python Bindings' , 'Alternative Redis-Like Databases with Python' ] ) #NEWLINE# tags = self . Q . select ( APIData . data . extract ( 'metadata.tags' ) . alias ( 'tags' ) ) . dicts ( ) #NEWLINE# self . assertEqual ( list ( tags ) , [ { #NEWLINE# #INDENT# 'tags' : [ 'python' , 'sqlite' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'tags' : [ 'nosql' , 'python' , 'sqlite' , 'cython' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'tags' : [ 'sqlite' , 'search' , 'python' , 'peewee' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'tags' : [ 'nosql' , 'python' , 'unqlite' , 'cython' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'tags' : [ 'python' , 'walrus' , 'redis' , 'nosql' ] , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# missing = self . Q . select ( APIData . data . extract ( 'foo.bar' ) ) . tuples ( ) #NEWLINE# self . assertEqual ( [ row for ( row , ) in missing ] , ( [ None ] * 5 ) )