예제 #1
0
 def test_nested(self):
     """Testing prefix_q prefixes nested expressions"""
     self.assertEqual(
         six.text_type(
             prefix_q('fk',
                      Q(foo='foo') | (Q(bar='bar') & Q(baz='baz')))),
         six.text_type(
             Q(fk__foo='foo') | (Q(fk__bar='bar') & Q(fk__baz='baz'))))
예제 #2
0
 def test_nested(self):
     """Testing prefix_q prefixes nested expressions"""
     self.assertEqual(
         str(prefix_q('fk',
                      Q(foo='foo') |
                      (Q(bar='bar') &
                       Q(baz='baz')))),
         str(Q(fk__foo='foo') |
             (Q(fk__bar='bar') &
              Q(fk__baz='baz'))))
예제 #3
0
 def test_bytestring_result(self):
     """Testing that prefix_q generates byte strings for key names"""
     q = prefix_q('fk', Q(foo='bar'))
     self.assertEqual(len(q.children), 1)
     self.assertIs(type(q.children[0]), tuple)
     self.assertIsInstance(q.children[0][0], six.binary_type)
예제 #4
0
 def test_simple(self):
     """Testing prefix_q prefixes simple expressions"""
     self.assertEqual(
         six.text_type(prefix_q('fk', Q(hello='goodbye'))),
         six.text_type(Q(fk__hello='goodbye')))
예제 #5
0
 def test_bytestring_result(self):
     """Testing that prefix_q generates byte strings for key names"""
     q = prefix_q('fk', Q(foo='bar'))
     self.assertEqual(len(q.children), 1)
     self.assertIs(type(q.children[0]), tuple)
     self.assertIsInstance(q.children[0][0], str)
예제 #6
0
 def test_simple(self):
     """Testing prefix_q prefixes simple expressions"""
     self.assertEqual(str(prefix_q('fk', Q(hello='goodbye'))),
                      str(Q(fk__hello='goodbye')))