Example #1
0
 def final_sql(self):
     return swap_params(self.sql, self.available_params())
Example #2
0
 def test_empty_params_does_nothing(self):
     sql = 'please swap $$this$$ and $$that$$'
     params = None
     got = swap_params(sql, params)
     self.assertEqual(got, sql)
Example #3
0
 def test_non_string_param_gets_swapper(self):
     sql = 'please swap $$this$$'
     expected = 'please swap 1'
     params = {'this': 1}
     got = swap_params(sql, params)
     self.assertEqual(got, expected)
 def test_non_string_param_gets_swapper(self):
     sql = 'please swap $$this$$'
     expected = 'please swap 1'
     params = {'this': 1}
     got = swap_params(sql, params)
     self.assertEqual(got, expected)
Example #5
0
 def test_params_get_swapped(self):
     sql = 'please swap $$this$$ and $$that$$'
     expected = 'please swap here and there'
     params = {'this': 'here', 'that': 'there'}
     got = swap_params(sql, params)
     self.assertEqual(got, expected)
 def test_params_get_swapped(self):
     sql = 'please Swap $$this$$ and $$THat$$'
     expected = 'please Swap here and there'
     params = {'this': 'here', 'that': 'there'}
     got = swap_params(sql, params)
     self.assertEqual(got, expected)
 def test_empty_params_does_nothing(self):
     sql = 'please swap $$this$$ and $$that$$'
     params = None
     got = swap_params(sql, params)
     self.assertEqual(got, sql)
Example #8
0
 def final_sql(self):
     return swap_params(self.sql, self.params)
 def final_sql(self):
     return swap_params(self.sql, self.params)
 def final_sql(self):
     return swap_params(self.sql, self.available_params())
 def final_sql(self, params=None):
     return swap_params(self.sql, params)
Example #12
0
 def final_sql(self, params=None):
     return swap_params(self.sql, params)
 def test_non_string_param_gets_swapper(self):
     sql = "please swap $$this$$"
     expected = "please swap 1"
     params = {"this": 1}
     got = swap_params(sql, params)
     self.assertEqual(got, expected)
 def test_params_get_swapped(self):
     sql = "please swap $$this$$ and $$that$$"
     expected = "please swap here and there"
     params = {"this": "here", "that": "there"}
     got = swap_params(sql, params)
     self.assertEqual(got, expected)