#NEWLINE# def test_filter( self ) : #NEWLINE# #INDENT# t = MyModel ( name = 't1' , field = 0 , multi = dict ( sub1 = 'aaa' ) ) #NEWLINE# t . save ( ) #NEWLINE# t2 = MyModel ( name = 't2' , field = 0 ) #NEWLINE# t2 . save ( ) #NEWLINE# t3 = MyModel ( name = 't3' , field = 5 , multi = dict ( sub1 = 'bbb' ) ) #NEWLINE# t3 . save ( ) #NEWLINE# t4 = MyModel ( name = 't4' , field = 5 ) #NEWLINE# t4 . save ( ) #NEWLINE# o = MyModel . objects #NEWLINE# assert ( len ( o . filter ( multi__sub2 = 15 ) ) == 4 ) #NEWLINE# assert ( len ( o . filter ( field = 0 ) ) == 2 ) #NEWLINE# assert ( len ( o . filter ( field = 0 ) ) == 2 ) #NEWLINE# assert ( len ( o . filter ( name = 't3' , field = 0 ) ) == 0 ) #NEWLINE# assert ( len ( o . filter ( name = 't1' , field = 0 ) ) == 1 ) #NEWLINE# assert ( len ( o . filter ( name = 't2' , field = 0 ) ) == 1 ) #NEWLINE# assert ( o . get ( name = 't2' , field = 0 ) . id == t2 . id ) #NEWLINE# assert ( o . get ( name = 't2' , multi__sub1 = 'abc' ) . id == t2 . id )