@@ -730,6 +730,11 @@ def test_all_in(self, initquery):
730
730
expected = 'endAt=3&equalTo=2&limitToFirst=10&orderBy="{0}"&startAt=1' .format (order_by )
731
731
assert query ._querystr == expected
732
732
733
+ def test_invalid_query_args (self ):
734
+ ref = db .Reference (path = 'foo' )
735
+ with pytest .raises (ValueError ):
736
+ db .Query (order_by = '$key' , client = ref ._client , pathurl = ref ._add_suffix (), foo = 'bar' )
737
+
733
738
734
739
class TestSorter (object ):
735
740
"""Test cases for db._Sorter class."""
@@ -740,6 +745,7 @@ class TestSorter(object):
740
745
({'k1' : 3 , 'k2' : 1 , 'k3' : 2 }, ['k2' , 'k3' , 'k1' ]),
741
746
({'k1' : 3 , 'k2' : 1 , 'k3' : 1 }, ['k2' , 'k3' , 'k1' ]),
742
747
({'k1' : 1 , 'k2' : 2 , 'k3' : 1 }, ['k1' , 'k3' , 'k2' ]),
748
+ ({'k1' : 2 , 'k2' : 2 , 'k3' : 1 }, ['k3' , 'k1' , 'k2' ]),
743
749
({'k1' : 'foo' , 'k2' : 'bar' , 'k3' : 'baz' }, ['k2' , 'k3' , 'k1' ]),
744
750
({'k1' : 'foo' , 'k2' : 'bar' , 'k3' : 10 }, ['k3' , 'k2' , 'k1' ]),
745
751
({'k1' : 'foo' , 'k2' : 'bar' , 'k3' : None }, ['k3' , 'k2' , 'k1' ]),
@@ -758,6 +764,8 @@ class TestSorter(object):
758
764
([1 , 2 , 3 ], [1 , 2 , 3 ]),
759
765
([3 , 2 , 1 ], [1 , 2 , 3 ]),
760
766
([1 , 3 , 2 ], [1 , 2 , 3 ]),
767
+ ([1 , 3 , 3 ], [1 , 3 , 3 ]),
768
+ ([2 , 3 , 2 ], [2 , 2 , 3 ]),
761
769
(['foo' , 'bar' , 'baz' ], ['bar' , 'baz' , 'foo' ]),
762
770
(['foo' , 1 , False , None , 0 , True ], [None , False , True , 0 , 1 , 'foo' ]),
763
771
]
0 commit comments