def final_sql(self): return swap_params(self.sql, self.available_params())
def test_empty_params_does_nothing(self): sql = 'please swap $$this$$ and $$that$$' params = None got = swap_params(sql, params) self.assertEqual(got, sql)
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)
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 final_sql(self): return swap_params(self.sql, self.params)
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)