@@ -65,7 +65,11 @@ def test_qb_computed_02(self):
6565 self .assertEqual (res .name , "Alice" )
6666 self .assertEqual (res .nickname , "Little Alice" )
6767
68- @tb .xfail
68+ @tb .xfail_unimplemented ('''
69+ Needs casts. Issue #672.
70+ Medium priority.
71+ (We might do different syntax and need to change the test.)
72+ ''' )
6973 def test_qb_computed_03 (self ):
7074 from models .orm import default , std
7175
@@ -187,6 +191,25 @@ def test_qb_order_03(self):
187191 [("Alice" , False ), ("Billie" , True )],
188192 )
189193
194+ @tb .xfail ('''
195+ Broken because of bug #893
196+ ''' )
197+ def test_qb_order_04 (self ):
198+ from models .orm import default , std
199+
200+ res = self .client .query (
201+ default .UserGroup .select (
202+ name = True ,
203+ )
204+ .filter (
205+ lambda g : std .count (g .users .filter (lambda u : u .name_len > 5 ))
206+ >= 0
207+ )
208+ .order_by (name = True )
209+ )
210+ names = [x .name for x in res ]
211+ self .assertEqual (names , sorted (names ))
212+
190213 def test_qb_filter_01 (self ):
191214 from models .orm import default , std
192215
@@ -227,7 +250,6 @@ def test_qb_filter_02(self):
227250 ["Alice" , "Billie" , "Cameron" , "Dana" ],
228251 )
229252
230- @tb .xfail
231253 def test_qb_filter_03 (self ):
232254 from models .orm import default
233255
@@ -240,8 +262,18 @@ def test_qb_filter_03(self):
240262 )
241263 self .assertEqual (res .name , "red" )
242264 self .assertEqual (res .mascot , "dragon" )
265+
266+ # We didn't fetch name as part of that query so we need to
267+ # fetch them separately to check that the order still worked.
268+ users = []
269+ for u in res .users :
270+ ures = self .client .get (
271+ default .User .select (name = True ).filter (id = u .id )
272+ )
273+ users .append (ures .name )
274+
243275 self .assertEqual (
244- [ u . name for u in res . users ] , ["Alice" , "Billie" , "Cameron" , "Dana" ]
276+ users , ["Alice" , "Billie" , "Cameron" , "Dana" ]
245277 )
246278
247279 def test_qb_filter_04 (self ):
@@ -261,7 +293,11 @@ def test_qb_filter_04(self):
261293 [u .name for u in res .users ], ["Cameron" , "Billie" , "Alice" ]
262294 )
263295
264- @tb .xfail
296+ @tb .xfail_unimplemented ('''
297+ I think supporting *typing* this will need a PEP.
298+ We could make it work dynamically if we wanted, though
299+ or add a **kwargs.
300+ ''' )
265301 def test_qb_filter_05 (self ):
266302 from models .orm import default , std
267303
@@ -275,7 +311,10 @@ def test_qb_filter_05(self):
275311 self .assertEqual (res .name , "red" )
276312 self .assertEqual (res .user_count , 4 )
277313
278- @tb .xfail
314+ @tb .xfail_unimplemented ('''
315+ I think supporting *typing* this will need a PEP.
316+ We could make it work dynamically if we wanted, though.
317+ ''' )
279318 def test_qb_filter_06 (self ):
280319 from models .orm import default , std
281320
@@ -323,7 +362,10 @@ def test_qb_filter_08(self):
323362 self .assertEqual (post .author .name , "Elsa" )
324363 self .assertEqual (post .body , "*magic stuff*" )
325364
326- @tb .skip_typecheck # FIXME: array equality busted
365+ @tb .xfail ('''
366+ == on Array seems busted both for the typechecker and runtime
367+ Issue #896
368+ ''' )
327369 def test_qb_filter_09 (self ):
328370 from models .orm import default , std
329371
@@ -413,22 +455,18 @@ def test_qb_multiprop_01(self):
413455 self .assertEqual (res [1 ].str , "hello world" )
414456 self .assertEqual (set (res [1 ].p_multi_str ), {"brown" , "fox" })
415457
416- @tb .xfail
417458 def test_qb_multiprop_02 (self ):
418- from models .orm import default
459+ from models .orm import default , std
419460
420- # FIXME: This straight up hangs
421- raise Exception ("This filter will hang" )
422461 res = self .client .get (
423462 default .KitchenSink .select (
424463 str = True ,
425464 p_multi_str = True ,
426- ).filter (lambda k : "quick" in k .p_multi_str )
465+ ).filter (lambda k : std . in_ ( "quick" , k .p_multi_str ) )
427466 )
428467 self .assertEqual (res .str , "another one" )
429468 self .assertEqual (set (res .p_multi_str ), {"quick" , "fox" , "jumps" })
430469
431- @tb .xfail
432470 def test_qb_multiprop_03 (self ):
433471 from models .orm import default
434472
@@ -437,26 +475,32 @@ def test_qb_multiprop_03(self):
437475 str = True ,
438476 p_multi_str = True ,
439477 # In filters == and in behave similarly for multi props
440- ).filter (lambda k : "quick" == k . p_multi_str )
478+ ).filter (lambda k : k . p_multi_str == "quick" )
441479 )
442480 self .assertEqual (res .str , "another one" )
443481 self .assertEqual (set (res .p_multi_str ), {"quick" , "fox" , "jumps" })
444482
445- @tb .xfail
483+ @tb .xfail_unimplemented ('''
484+ We don't support .order_by on a multi prop.
485+ We might want *some* way to do it.
486+ ''' )
446487 def test_qb_multiprop_04 (self ):
447488 from models .orm import default
448489
449490 res = self .client .get (
450491 default .KitchenSink .select (
451492 str = True ,
452- # FIXME: Not sure how to express filtering a multi prop
493+ # FIXME: Not sure how to express ordering a multi prop
453494 p_multi_str = lambda k : k .p_multi_str .order_by (k .p_multi_str ),
454495 ).filter (str = "another one" )
455496 )
456497 self .assertEqual (res .str , "another one" )
457498 self .assertEqual (set (res .p_multi_str ), {"brown" , "jumps" })
458499
459- @tb .xfail
500+ @tb .xfail_unimplemented ('''
501+ We don't support .filter on a multi prop.
502+ We might want *some* way to do it.
503+ ''' )
460504 def test_qb_multiprop_05 (self ):
461505 from models .orm import default , std
462506
@@ -537,7 +581,11 @@ def test_qb_boolean_operator_error_01(self):
537581 with self .assertRaisesRegex (TypeError , "use std.exists" ):
538582 default .User .filter (lambda u : u .name is not None ) # type: ignore
539583
540- @tb .xfail
584+ @tb .xfail ('''
585+ Filtering on enums broken. And Enums need __gel_type_class__?
586+ See #635
587+ ''' )
588+ @tb .skip_typecheck
541589 def test_qb_enum_01 (self ):
542590 from models .orm import default
543591
@@ -587,7 +635,12 @@ def test_qb_update_02(self):
587635 self .assertEqual (res .name , "blue" )
588636 self .assertEqual ({u .name for u in res .users }, {"Zoe" , "Dana" })
589637
590- @tb .xfail
638+ @tb .xfail ('''
639+ Runtime failure because assert_single doesn't work.
640+ Bug #897.
641+
642+ Also fails at typecheck time because assert_single can return None?
643+ ''' )
591644 def test_qb_update_03 (self ):
592645 from models .orm import default , std
593646
@@ -604,7 +657,13 @@ def test_qb_update_03(self):
604657 self .assertEqual (res .author .name , "Zoe" )
605658 self .assertEqual ({g .name for g in res .author .groups }, {"redgreen" })
606659
607- @tb .xfail
660+ @tb .xfail ('''
661+ Runtime failure because assert_single doesn't work.
662+ Bug #897.
663+
664+ Also fails at typecheck time because update's *types* dont't
665+ support callbacks, though runtime does.
666+ ''' )
608667 def test_qb_update_04 (self ):
609668 from models .orm import default , std
610669
@@ -714,7 +773,10 @@ def test_qb_delete_03(self):
714773 self .assertEqual (res [1 ].body , "I'm Alice" )
715774 self .assertEqual (res [1 ].author .name , "Alice" )
716775
717- @tb .xfail
776+ @tb .xfail ('''
777+ Filtering on enums broken. And Enums need __gel_type_class__?
778+ See #635
779+ ''' )
718780 def test_qb_enum_edit_01 (self ):
719781 from models .orm import default
720782
@@ -729,7 +791,10 @@ def test_qb_enum_edit_01(self):
729791 self .assertEqual (e .color , default .Color .Orange )
730792 self .assertEqual (e .name , "red" )
731793
732- @tb .xfail
794+ @tb .xfail ('''
795+ Filtering on enums broken. And Enums need __gel_type_class__?
796+ See #635
797+ ''' )
733798 def test_qb_enum_edit_02 (self ):
734799 from models .orm import default
735800
0 commit comments