Example #1
0
    def test_stack_output(self):
        self.assertEqual(u'foo', mappings.stack_output('foo'))
        self.assertEqual(u'', mappings.stack_output(None))

        self.assertEqual(u'<pre>[\n  "one", \n  "two", \n  "three"\n]</pre>',
                         mappings.stack_output(['one', 'two', 'three']))
        self.assertEqual(u'<pre>{\n  "foo": "bar"\n}</pre>',
                         mappings.stack_output({'foo': 'bar'}))

        self.assertEqual(
            u'<a href="http://www.example.com/foo" target="_blank">'
            'http://www.example.com/foo</a>',
            mappings.stack_output('http://www.example.com/foo'))
Example #2
0
    def test_stack_output(self):
        self.assertEqual(u'foo', mappings.stack_output('foo'))
        self.assertEqual(u'', mappings.stack_output(None))

        self.assertEqual(
            u'<pre>[\n  "one", \n  "two", \n  "three"\n]</pre>',
            mappings.stack_output(['one', 'two', 'three']))
        self.assertEqual(
            u'<pre>{\n  "foo": "bar"\n}</pre>',
            mappings.stack_output({'foo': 'bar'}))

        self.assertEqual(
            u'<a href="http://www.example.com/foo" target="_blank">'
            'http://www.example.com/foo</a>',
            mappings.stack_output('http://www.example.com/foo'))
Example #3
0
    def test_stack_output(self):
        self.assertEqual(u"foo", mappings.stack_output("foo"))
        self.assertEqual(u"", mappings.stack_output(None))

        outputs = ["one", "two", "three"]
        expected_text = """[\n  "one", \n  "two", \n  "three"\n]"""

        self.assertEqual(u"<pre>%s</pre>" % html.escape(expected_text), mappings.stack_output(outputs))

        outputs = {"foo": "bar"}
        expected_text = """{\n  "foo": "bar"\n}"""
        self.assertEqual(u"<pre>%s</pre>" % html.escape(expected_text), mappings.stack_output(outputs))

        self.assertEqual(
            u'<a href="http://www.example.com/foo" target="_blank">' "http://www.example.com/foo</a>",
            mappings.stack_output("http://www.example.com/foo"),
        )
Example #4
0
    def test_stack_output(self):
        self.assertEqual(u'foo', mappings.stack_output('foo'))
        self.assertEqual(u'', mappings.stack_output(None))

        outputs = ['one', 'two', 'three']
        expected_text = """[\n  "one", \n  "two", \n  "three"\n]"""

        self.assertEqual(u'<pre>%s</pre>' % html.escape(expected_text),
                         mappings.stack_output(outputs))

        outputs = {'foo': 'bar'}
        expected_text = """{\n  "foo": "bar"\n}"""
        self.assertEqual(u'<pre>%s</pre>' % html.escape(expected_text),
                         mappings.stack_output(outputs))

        self.assertEqual(
            u'<a href="http://www.example.com/foo" target="_blank">'
            'http://www.example.com/foo</a>',
            mappings.stack_output('http://www.example.com/foo'))
Example #5
0
    def test_stack_output(self):
        self.assertEqual(u"<pre>foo</pre>", mappings.stack_output("foo"))
        self.assertEqual(u"", mappings.stack_output(None))

        outputs = ["one", "two", "three"]
        # On Python 3, the pretty JSON output doesn't add space before newline
        if six.PY3:
            expected_text = """[\n  "one",\n  "two",\n  "three"\n]"""
        else:
            expected_text = """[\n  "one", \n  "two", \n  "three"\n]"""

        self.assertEqual(u"<pre>%s</pre>" % html.escape(expected_text), mappings.stack_output(outputs))

        outputs = {"foo": "bar"}
        expected_text = """{\n  "foo": "bar"\n}"""
        self.assertEqual(u"<pre>%s</pre>" % html.escape(expected_text), mappings.stack_output(outputs))

        self.assertEqual(
            u'<a href="http://www.example.com/foo" target="_blank">' "http://www.example.com/foo</a>",
            mappings.stack_output("http://www.example.com/foo"),
        )
Example #6
0
    def test_stack_output(self):
        self.assertEqual(u'<pre>foo</pre>', mappings.stack_output('foo'))
        self.assertEqual(u'', mappings.stack_output(None))

        outputs = ['one', 'two', 'three']
        # On Python 3, the pretty JSON output doesn't add space before newline
        if six.PY3:
            expected_text = """[\n  "one",\n  "two",\n  "three"\n]"""
        else:
            expected_text = """[\n  "one", \n  "two", \n  "three"\n]"""

        self.assertEqual(u'<pre>%s</pre>' % html.escape(expected_text),
                         mappings.stack_output(outputs))

        outputs = {'foo': 'bar'}
        expected_text = """{\n  "foo": "bar"\n}"""
        self.assertEqual(u'<pre>%s</pre>' % html.escape(expected_text),
                         mappings.stack_output(outputs))

        self.assertEqual(
            u'<a href="http://www.example.com/foo" target="_blank">'
            'http://www.example.com/foo</a>',
            mappings.stack_output('http://www.example.com/foo'))
    def test_stack_output(self):
        self.assertEqual(u'<pre>foo</pre>', mappings.stack_output('foo'))
        self.assertEqual(u'', mappings.stack_output(None))

        outputs = ['one', 'two', 'three']
        # On Python 3, the pretty JSON output doesn't add space before newline
        if six.PY3:
            expected_text = """[\n  "one",\n  "two",\n  "three"\n]"""
        else:
            expected_text = """[\n  "one", \n  "two", \n  "three"\n]"""

        self.assertEqual(u'<pre>%s</pre>' % html.escape(expected_text),
                         mappings.stack_output(outputs))

        outputs = {'foo': 'bar'}
        expected_text = """{\n  "foo": "bar"\n}"""
        self.assertEqual(u'<pre>%s</pre>' % html.escape(expected_text),
                         mappings.stack_output(outputs))

        self.assertEqual(
            u'<a href="http://www.example.com/foo" target="_blank">'
            'http://www.example.com/foo</a>',
            mappings.stack_output('http://www.example.com/foo'))