コード例 #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')")
コード例 #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)")
コード例 #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')")
コード例 #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')")