コード例 #1
0
ファイル: test_jinja_helpers.py プロジェクト: adngdb/socorro
    def test_show_filesize(self):
        html = show_filesize(100)
        ok_(isinstance(html, SafeText))
        eq_(
            html,
            '100 bytes'
        )

        html = show_filesize(10000)
        ok_(isinstance(html, SafeText))
        eq_(
            html,
            '10,000 bytes '
            '<span class="humanized" title="10,000 bytes">'
            '(9.77 KB)</span>'
        )

        html = show_filesize('10000')
        ok_(isinstance(html, SafeText))
        eq_(
            html,
            '10,000 bytes '
            '<span class="humanized" title="10,000 bytes">'
            '(9.77 KB)</span>'
        )
コード例 #2
0
    def test_show_filesize(self):
        html = show_filesize(100)
        assert isinstance(html, SafeText)
        assert html == "100 bytes"

        html = show_filesize(10000)
        assert isinstance(html, SafeText)
        expected = ("10,000 bytes "
                    '<span class="humanized" title="10,000 bytes">'
                    "(10 KB)</span>")
        assert html == expected

        html = show_filesize("10000")
        assert isinstance(html, SafeText)
        expected = ("10,000 bytes "
                    '<span class="humanized" title="10,000 bytes">'
                    "(10 KB)</span>")
        assert html == expected
コード例 #3
0
ファイル: test_jinja_helpers.py プロジェクト: maxsd32/socorro
    def test_show_filesize(self):
        html = show_filesize(100)
        assert isinstance(html, SafeText)
        assert html == '100 bytes'

        html = show_filesize(10000)
        assert isinstance(html, SafeText)
        expected = ('10,000 bytes '
                    '<span class="humanized" title="10,000 bytes">'
                    '(10 KB)</span>')
        assert html == expected

        html = show_filesize('10000')
        assert isinstance(html, SafeText)
        expected = ('10,000 bytes '
                    '<span class="humanized" title="10,000 bytes">'
                    '(10 KB)</span>')
        assert html == expected
コード例 #4
0
    def test_show_filesize(self):
        html = show_filesize(100)
        ok_(isinstance(html, SafeText))
        eq_(html, '100 bytes')

        html = show_filesize(10000)
        ok_(isinstance(html, SafeText))
        eq_(
            html, '10,000 bytes '
            '<span class="humanized" title="10,000 bytes">'
            '(9.77 KB)</span>')

        html = show_filesize('10000')
        ok_(isinstance(html, SafeText))
        eq_(
            html, '10,000 bytes '
            '<span class="humanized" title="10,000 bytes">'
            '(9.77 KB)</span>')
コード例 #5
0
    def test_show_filesize(self):
        html = show_filesize(100)
        assert isinstance(html, SafeText)
        assert html == '100 bytes'

        html = show_filesize(10000)
        assert isinstance(html, SafeText)
        expected = (
            '10,000 bytes '
            '<span class="humanized" title="10,000 bytes">'
            '(10 KB)</span>'
        )
        assert html == expected

        html = show_filesize('10000')
        assert isinstance(html, SafeText)
        expected = (
            '10,000 bytes '
            '<span class="humanized" title="10,000 bytes">'
            '(10 KB)</span>'
        )
        assert html == expected
コード例 #6
0
    def test_show_filesize_failing(self):
        html = show_filesize(None)
        assert html is None

        html = show_filesize("junk")
        assert html == "junk"
コード例 #7
0
    def test_show_filesize_failing(self):
        html = show_filesize(None)
        eq_(html, None)

        html = show_filesize('junk')
        eq_(html, 'junk')
コード例 #8
0
ファイル: test_jinja_helpers.py プロジェクト: adngdb/socorro
    def test_show_filesize_failing(self):
        html = show_filesize(None)
        eq_(html, None)

        html = show_filesize('junk')
        eq_(html, 'junk')
コード例 #9
0
    def test_show_filesize_failing(self):
        html = show_filesize(None)
        assert html is None

        html = show_filesize('junk')
        assert html == 'junk'