Example #1
0
    def test_build_where_clause_quoted_value(self):
        where_clause = utils.build_choose_clause(choices=["val1", "Someone's Company"], field="field1")

        self.assertEqual(where_clause, "field1 in ('val1', 'Someone\\\'s Company')")
Example #2
0
    def test_build_where_clause_integers(self):
        where_clause = utils.build_choose_clause(choices=[1, 2], field="field1")

        self.assertEqual(where_clause, "field1 in (1, 2)")
Example #3
0
    def test_build_where_clause_strings(self):
        where_clause = utils.build_choose_clause(choices=["val1", "val2"], field="field1")

        self.assertEqual(where_clause, "field1 in ('val1', 'val2')")
Example #4
0
    def test_build_choose_clause_unicode_escaped(self):
        where_clause = utils.build_choose_clause(
            choices=[u"Test - & % $", u"Another's Test"], field="field1")

        self.assertEqual(where_clause,
                         "field1 in ('Test - & % $', 'Another\\\'s Test')")