Exemplo n.º 1
0
    def join_fields(self, fields):
        parts = []
        for name, val in fields.items():
            if not isinstance(val, str):
                val = str(val)
            parts.append(name + '=' + quote(val))

        return ', '.join(parts)
Exemplo n.º 2
0
    def join_fields(self, fields):
        parts = []
        for name, val in fields.items():
            if not isinstance(val, str):
                val = str(val)
            parts.append(name + '=' + quote(val))

        return ', '.join(parts)
Exemplo n.º 3
0
 def test_quote_unprintable_chars(self):
     assert quote('\x8Ffoo\xA3bar').lower() == r'"\x8Ffoo\xA3bar"'.lower()
Exemplo n.º 4
0
 def test_quote_control_characters(self):
     assert quote("\r\n\t") == r'"\r\n\t"'
Exemplo n.º 5
0
 def test_will_escape(self):
     assert quote(r'foo"bar') == r'"foo\"bar"'
     assert quote(r'foo\bar') == r'"foo\\bar"'
Exemplo n.º 6
0
 def test_will_quote_string(self):
     assert quote('foobar') == '"foobar"'
     assert quote('foo bar baz') == '"foo bar baz"'
     assert quote('foobar', quote='`') == '`foobar`'