def test_count(self):
     ss = SelectStatement('table', count=True, limit=10, order_by='d')
     ss.add_where_clause(WhereClause('a', EqualsOperator(), 'b'))
     self.assertEqual(
         six.text_type(ss),
         'SELECT COUNT(*) FROM table WHERE "a" = %(0)s LIMIT 10',
         six.text_type(ss))
     self.assertIn('LIMIT', six.text_type(ss))
     self.assertNotIn('ORDER', six.text_type(ss))
예제 #2
0
    def test_context_id_update(self):
        """ tests that the right things happen the the context id """
        ss = SelectStatement("table")
        ss.add_where_clause(WhereClause("a", EqualsOperator(), "b"))
        self.assertEqual(ss.get_context(), {"0": "b"})
        self.assertEqual(str(ss), 'SELECT * FROM table WHERE "a" = :0')

        ss.update_context_id(5)
        self.assertEqual(ss.get_context(), {"5": "b"})
        self.assertEqual(str(ss), 'SELECT * FROM table WHERE "a" = :5')
    def test_context_id_update(self):
        """ tests that the right things happen the the context id """
        ss = SelectStatement('table')
        ss.add_where_clause(WhereClause('a', EqualsOperator(), 'b'))
        self.assertEqual(ss.get_context(), {'0': 'b'})
        self.assertEqual(str(ss), 'SELECT * FROM table WHERE "a" = %(0)s')

        ss.update_context_id(5)
        self.assertEqual(ss.get_context(), {'5': 'b'})
        self.assertEqual(str(ss), 'SELECT * FROM table WHERE "a" = %(5)s')
예제 #4
0
    def test_context_id_update(self):
        """ tests that the right things happen the the context id """
        ss = SelectStatement('table')
        ss.add_where_clause(WhereClause('a', EqualsOperator(), 'b'))
        self.assertEqual(ss.get_context(), {'0': 'b'})
        self.assertEqual(str(ss), 'SELECT * FROM table WHERE "a" = %(0)s')

        ss.update_context_id(5)
        self.assertEqual(ss.get_context(), {'5': 'b'})
        self.assertEqual(str(ss), 'SELECT * FROM table WHERE "a" = %(5)s')
예제 #5
0
 def test_context(self):
     ss = SelectStatement("table")
     ss.add_where_clause(WhereClause("a", EqualsOperator(), "b"))
     self.assertEqual(ss.get_context(), {"0": "b"})
예제 #6
0
 def test_count(self):
     ss = SelectStatement("table", count=True, limit=10, order_by="d")
     ss.add_where_clause(WhereClause("a", EqualsOperator(), "b"))
     self.assertEqual(unicode(ss), 'SELECT COUNT(*) FROM table WHERE "a" = :0', unicode(ss))
     self.assertNotIn("LIMIT", unicode(ss))
     self.assertNotIn("ORDER", unicode(ss))
예제 #7
0
 def test_where_clause_rendering(self):
     ss = SelectStatement("table")
     ss.add_where_clause(WhereClause("a", EqualsOperator(), "b"))
     self.assertEqual(unicode(ss), 'SELECT * FROM table WHERE "a" = :0', unicode(ss))
 def test_context(self):
     ss = SelectStatement('table')
     ss.add_where_clause(WhereClause('a', EqualsOperator(), 'b'))
     self.assertEqual(ss.get_context(), {'0': 'b'})
 def test_where_clause_rendering(self):
     ss = SelectStatement('table')
     ss.add_where_clause(WhereClause('a', EqualsOperator(), 'b'))
     self.assertEqual(six.text_type(ss),
                      'SELECT * FROM table WHERE "a" = %(0)s',
                      six.text_type(ss))
예제 #10
0
 def test_context(self):
     ss = SelectStatement('table')
     ss.add_where_clause(WhereClause('a', EqualsOperator(), 'b'))
     self.assertEqual(ss.get_context(), {'0': 'b'})
예제 #11
0
 def test_count(self):
     ss = SelectStatement('table', count=True, limit=10, order_by='d')
     ss.add_where_clause(WhereClause('a', EqualsOperator(), 'b'))
     self.assertEqual(unicode(ss), 'SELECT COUNT(*) FROM table WHERE "a" = %(0)s LIMIT 10', unicode(ss))
     self.assertIn('LIMIT', unicode(ss))
     self.assertNotIn('ORDER', unicode(ss))
예제 #12
0
 def test_where_clause_rendering(self):
     ss = SelectStatement('table')
     ss.add_where_clause(WhereClause('a', EqualsOperator(), 'b'))
     self.assertEqual(unicode(ss), 'SELECT * FROM table WHERE "a" = %(0)s', unicode(ss))