示例#1
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>'
        )
示例#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
    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>')
    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
    def test_show_filesize_failing(self):
        html = show_filesize(None)
        eq_(html, None)

        html = show_filesize('junk')
        eq_(html, 'junk')
    def test_show_filesize_failing(self):
        html = show_filesize(None)
        assert html is None

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