Пример #1
0
 def test_split_expression(self):
     sq = SQ(foo='bar')
     
     self.assertEqual(sq.split_expression('foo'), ('foo', 'exact'))
     self.assertEqual(sq.split_expression('foo__exact'), ('foo', 'exact'))
     self.assertEqual(sq.split_expression('foo__lt'), ('foo', 'lt'))
     self.assertEqual(sq.split_expression('foo__lte'), ('foo', 'lte'))
     self.assertEqual(sq.split_expression('foo__gt'), ('foo', 'gt'))
     self.assertEqual(sq.split_expression('foo__gte'), ('foo', 'gte'))
     self.assertEqual(sq.split_expression('foo__in'), ('foo', 'in'))
     self.assertEqual(sq.split_expression('foo__startswith'), ('foo', 'startswith'))
     self.assertEqual(sq.split_expression('foo__range'), ('foo', 'range'))
     
     # Unrecognized filter. Fall back to exact.
     self.assertEqual(sq.split_expression('foo__moof'), ('foo', 'exact'))
Пример #2
0
 def test_split_expression(self):
     sq = SQ(foo='bar')
     
     self.assertEqual(sq.split_expression('foo'), ('foo', 'exact'))
     self.assertEqual(sq.split_expression('foo__exact'), ('foo', 'exact'))
     self.assertEqual(sq.split_expression('foo__lt'), ('foo', 'lt'))
     self.assertEqual(sq.split_expression('foo__lte'), ('foo', 'lte'))
     self.assertEqual(sq.split_expression('foo__gt'), ('foo', 'gt'))
     self.assertEqual(sq.split_expression('foo__gte'), ('foo', 'gte'))
     self.assertEqual(sq.split_expression('foo__in'), ('foo', 'in'))
     self.assertEqual(sq.split_expression('foo__startswith'), ('foo', 'startswith'))
     self.assertEqual(sq.split_expression('foo__range'), ('foo', 'range'))
     
     # Unrecognized filter. Fall back to exact.
     self.assertEqual(sq.split_expression('foo__moof'), ('foo', 'exact'))
Пример #3
0
    def test_split_expression(self):
        sq = SQ(foo="bar")

        self.assertEqual(sq.split_expression("foo"), ("foo", "exact"))
        self.assertEqual(sq.split_expression("foo__exact"), ("foo", "exact"))
        self.assertEqual(sq.split_expression("foo__lt"), ("foo", "lt"))
        self.assertEqual(sq.split_expression("foo__lte"), ("foo", "lte"))
        self.assertEqual(sq.split_expression("foo__gt"), ("foo", "gt"))
        self.assertEqual(sq.split_expression("foo__gte"), ("foo", "gte"))
        self.assertEqual(sq.split_expression("foo__in"), ("foo", "in"))
        self.assertEqual(sq.split_expression("foo__startswith"), ("foo", "startswith"))
        self.assertEqual(sq.split_expression("foo__range"), ("foo", "range"))

        # Unrecognized filter. Fall back to exact.
        self.assertEqual(sq.split_expression("foo__moof"), ("foo", "exact"))
Пример #4
0
    def test_split_expression(self):
        sq = SQ(foo="bar")

        self.assertEqual(sq.split_expression("foo"), ("foo", "content"))
        self.assertEqual(sq.split_expression("foo__exact"), ("foo", "exact"))
        self.assertEqual(sq.split_expression("foo__content"), ("foo", "content"))
        self.assertEqual(sq.split_expression("foo__contains"), ("foo", "contains"))
        self.assertEqual(sq.split_expression("foo__lt"), ("foo", "lt"))
        self.assertEqual(sq.split_expression("foo__lte"), ("foo", "lte"))
        self.assertEqual(sq.split_expression("foo__gt"), ("foo", "gt"))
        self.assertEqual(sq.split_expression("foo__gte"), ("foo", "gte"))
        self.assertEqual(sq.split_expression("foo__in"), ("foo", "in"))
        self.assertEqual(sq.split_expression("foo__startswith"), ("foo", "startswith"))
        self.assertEqual(sq.split_expression("foo__endswith"), ("foo", "endswith"))
        self.assertEqual(sq.split_expression("foo__range"), ("foo", "range"))
        self.assertEqual(sq.split_expression("foo__fuzzy"), ("foo", "fuzzy"))

        # Unrecognized filter. Fall back to exact.
        self.assertEqual(sq.split_expression("foo__moof"), ("foo", "content"))