예제 #1
0
    def test_print_stderr(self):
        res = self.app.get('/')
        res.charset = 'utf-8'
        res.text = '°C'
        print_stderr(str(res))

        res.charset = None
        print_stderr(str(res))
예제 #2
0
    def test_print_stderr(self):
        res = self.app.get('/')
        res.charset = 'utf-8'
        res.text = '°C'
        print_stderr(str(res))

        res.charset = None
        print_stderr(str(res))
예제 #3
0
    def mustcontain(self, *strings, **kw):
        """mustcontain(*strings, no=[])

        Assert that the response contains all of the strings passed
        in as arguments.

        Equivalent to::

            assert string in res

        Can take a `no` keyword argument that can be a string or a
        list of strings which must not be present in the response.
        """
        if 'no' in kw:
            no = kw['no']
            del kw['no']
            if isinstance(no, str):
                no = [no]
        else:
            no = []
        if kw:
            raise TypeError("The only keyword argument allowed is 'no'")
        for s in strings:
            if s not in self:
                print_stderr("Actual response (no %r):" % s)
                print_stderr(str(self))
                raise IndexError("Body does not contain string %r" % s)
        for no_s in no:
            if no_s in self:
                print_stderr("Actual response (has %r)" % no_s)
                print_stderr(str(self))
                raise IndexError("Body contains bad string %r" % no_s)
예제 #4
0
파일: app.py 프로젝트: humble/webtest
    def mustcontain(self, *strings, **kw):
        """
        Assert that the response contains all of the strings passed
        in as arguments.

        Equivalent to::

            assert string in res
        """
        if 'no' in kw:
            no = kw['no']
            del kw['no']
            if isinstance(no, string_types):
                no = [no]
        else:
            no = []
        if kw:
            raise TypeError(
                "The only keyword argument allowed is 'no'")
        for s in strings:
            if not s in self:
                print_stderr("Actual response (no %r):" % s)
                print_stderr(str(self))
                raise IndexError(
                    "Body does not contain string %r" % s)
        for no_s in no:
            if no_s in self:
                print_stderr("Actual response (has %r)" % no_s)
                print_stderr(str(self))
                raise IndexError(
                    "Body contains bad string %r" % no_s)
예제 #5
0
파일: response.py 프로젝트: Pylons/webtest
    def mustcontain(self, *strings, **kw):
        """mustcontain(*strings, no=[])

        Assert that the response contains all of the strings passed
        in as arguments.

        Equivalent to::

            assert string in res

        Can take a `no` keyword argument that can be a string or a
        list of strings which must not be present in the response.
        """
        if "no" in kw:
            no = kw["no"]
            del kw["no"]
            if isinstance(no, string_types):
                no = [no]
        else:
            no = []
        if kw:
            raise TypeError("The only keyword argument allowed is 'no'")
        for s in strings:
            if s not in self:
                print_stderr("Actual response (no %r):" % s)
                print_stderr(str(self))
                raise IndexError("Body does not contain string %r" % s)
        for no_s in no:
            if no_s in self:
                print_stderr("Actual response (has %r)" % no_s)
                print_stderr(str(self))
                raise IndexError("Body contains bad string %r" % no_s)
예제 #6
0
def test_print_unicode():
    print_stderr('°C')
예제 #7
0
def test_print_unicode():
    print_stderr('°C')