def test_with_alt_name(self): sql, bind_vars = sql_builder.build_in('col', [2, 4], alt_name='alt_col') self.assertEqual(sql, 'col IN (%(alt_col_1)s, %(alt_col_2)s)') self.assertEqual(bind_vars, dict(alt_col_1=2, alt_col_2=4))
def test_with_counter(self): counter = itertools.count(5) sql, bind_vars = sql_builder.build_in('col', [2, 4], counter=counter) self.assertEqual(sql, 'col IN (%(col_5)s, %(col_6)s)') self.assertEqual(bind_vars, dict(col_5=2, col_6=4))
def test_two_columns(self): sql, bind_vars = sql_builder.build_in('col', [2, 4]) self.assertEqual(sql, 'col IN (%(col_1)s, %(col_2)s)') self.assertEqual(bind_vars, dict(col_1=2, col_2=4))
def test_with_alt_name(self): sql, bind_vars = sql_builder.build_in("col", [2, 4], alt_name="alt_col") self.assertEqual(sql, "col IN (%(alt_col_1)s, %(alt_col_2)s)") self.assertEqual(bind_vars, dict(alt_col_1=2, alt_col_2=4))