#NEWLINE# def test_distinct_count( self ) : #NEWLINE# #INDENT# ( table2 , Obj1 , table1 ) = ( self . tables . table2 , self . classes . Obj1 , self . tables . table1 ) #NEWLINE# query = create_session ( ) . query ( Obj1 ) #NEWLINE# eq_ ( query . count ( ) , 4 ) #NEWLINE# res = query . filter ( sa . and_ ( ( table1 . c . id == table2 . c . t1id ) , ( self . c . t1id == 1 ) ) ) #NEWLINE# eq_ ( res . count ( ) , 3 ) #NEWLINE# res = query . filter ( sa . and_ ( ( table1 . c . id == table2 . c . t1id ) , ( table2 . c . t1id == 1 ) ) ) . distinct ( ) #NEWLINE# eq_ ( res . count ( ) , 1 )