Exemple #1
0
    def assertQuote(self, original, needs_quote, inner_quoted, quoted):
        self.assertEqual(posix.inner_quote(original), inner_quoted)
        self.assertEqual(posix.inner_quote_info(original),
                         (inner_quoted, needs_quote))

        self.assertEqual(posix.quote(original), quoted)
        self.assertEqual(posix.quote_info(original), (quoted, needs_quote))
        self.assertEqual(posix.force_quote(original),
                         posix.wrap_quotes(inner_quoted))
Exemple #2
0
 def test_escaped_quote(self):
     self.assertEqual(posix.wrap_quotes(r"'\''"), r"\'")
     self.assertEqual(posix.wrap_quotes(r"'\''foobar"), r"\''foobar'")
     self.assertEqual(posix.wrap_quotes(r"foo'\''bar"), r"'foo'\''bar'")
     self.assertEqual(posix.wrap_quotes(r"foobar'\''"), r"'foobar'\'")
Exemple #3
0
 def test_simple(self):
     self.assertEqual(posix.wrap_quotes(''), "''")
     self.assertEqual(posix.wrap_quotes('f'), "'f'")
     self.assertEqual(posix.wrap_quotes('fo'), "'fo'")
     self.assertEqual(posix.wrap_quotes('foo'), "'foo'")