コード例 #1
0
    def test_show_duration_safety(self):
        html = show_duration('<script>')
        ok_(not isinstance(html, SafeText))
        eq_(html, '<script>')

        html = show_duration(150, unit='<script>')
        ok_(isinstance(html, SafeText))
        eq_(
            html, '150 &lt;script&gt; '
            '<span class="humanized" title="150 &lt;script&gt;">'
            '(2 minutes and 30 seconds)</span>')
コード例 #2
0
    def test_show_duration_safety(self):
        html = show_duration("<script>")
        assert not isinstance(html, SafeText)
        assert html == "<script>"

        html = show_duration(150, unit="<script>")
        assert isinstance(html, SafeText)
        expected = ("150 &lt;script&gt; "
                    '<span class="humanized" title="150 &lt;script&gt;">'
                    "(2 minutes and 30 seconds)</span>")
        assert html == expected
コード例 #3
0
    def test_show_duration_safety(self):
        html = show_duration('<script>')
        assert not isinstance(html, SafeText)
        assert html == '<script>'

        html = show_duration(150, unit='<script>')
        assert isinstance(html, SafeText)
        expected = (
            '150 &lt;script&gt; '
            '<span class="humanized" title="150 &lt;script&gt;">'
            '(2 minutes and 30 seconds)</span>'
        )
        assert html == expected
コード例 #4
0
ファイル: test_jinja_helpers.py プロジェクト: adngdb/socorro
    def test_show_duration_safety(self):
        html = show_duration('<script>')
        ok_(not isinstance(html, SafeText))
        eq_(html, '<script>')

        html = show_duration(150, unit='<script>')
        ok_(isinstance(html, SafeText))
        eq_(
            html,
            '150 &lt;script&gt; '
            '<span class="humanized" title="150 &lt;script&gt;">'
            '(2 minutes and 30 seconds)</span>'
        )
コード例 #5
0
 def test_show_duration_different_unit(self):
     html = show_duration(150, unit="cool seconds")
     assert isinstance(html, SafeText)
     expected = ("150 cool seconds "
                 '<span class="humanized" title="150 cool seconds">'
                 "(2 minutes and 30 seconds)</span>")
     assert html == expected
コード例 #6
0
 def test_show_duration_different_unit(self):
     html = show_duration(150, unit='cool seconds')
     ok_(isinstance(html, SafeText))
     eq_(
         html, '150 cool seconds '
         '<span class="humanized" title="150 cool seconds">'
         '(2 minutes and 30 seconds)</span>')
コード例 #7
0
    def test_show_duration(self):
        html = show_duration(59)
        assert isinstance(html, SafeText)
        assert html == "59 seconds"

        html = show_duration(150)
        assert isinstance(html, SafeText)
        expected = ('150 seconds <span class="humanized" title="150 seconds">'
                    "(2 minutes and 30 seconds)</span>")
        assert html == expected

        # if the number is digit but a string it should work too
        html = show_duration("1500")
        expected = (
            '1,500 seconds <span class="humanized" title="1,500 seconds">'
            "(25 minutes)</span>")
        assert html == expected
コード例 #8
0
    def test_show_duration(self):
        html = show_duration(59)
        ok_(isinstance(html, SafeText))
        eq_(html, '59 seconds')

        html = show_duration(150)
        ok_(isinstance(html, SafeText))
        eq_(
            html, '150 seconds <span class="humanized" title="150 seconds">'
            '(2 minutes and 30 seconds)</span>')

        # if the number is digit but a string it should work too
        html = show_duration('1500')
        eq_(
            html,
            '1,500 seconds <span class="humanized" title="1,500 seconds">'
            '(25 minutes)</span>')
コード例 #9
0
ファイル: test_jinja_helpers.py プロジェクト: adngdb/socorro
 def test_show_duration_different_unit(self):
     html = show_duration(150, unit='cool seconds')
     ok_(isinstance(html, SafeText))
     eq_(
         html,
         '150 cool seconds '
         '<span class="humanized" title="150 cool seconds">'
         '(2 minutes and 30 seconds)</span>'
     )
コード例 #10
0
    def test_show_duration(self):
        html = show_duration(59)
        assert isinstance(html, SafeText)
        assert html == '59 seconds'

        html = show_duration(150)
        assert isinstance(html, SafeText)
        expected = (
            '150 seconds <span class="humanized" title="150 seconds">'
            '(2 minutes and 30 seconds)</span>'
        )
        assert html == expected

        # if the number is digit but a string it should work too
        html = show_duration('1500')
        expected = (
            '1,500 seconds <span class="humanized" title="1,500 seconds">'
            '(25 minutes)</span>'
        )
        assert html == expected
コード例 #11
0
ファイル: test_jinja_helpers.py プロジェクト: adngdb/socorro
    def test_show_duration(self):
        html = show_duration(59)
        ok_(isinstance(html, SafeText))
        eq_(
            html,
            '59 seconds'
        )

        html = show_duration(150)
        ok_(isinstance(html, SafeText))
        eq_(
            html,
            '150 seconds <span class="humanized" title="150 seconds">'
            '(2 minutes and 30 seconds)</span>'
        )

        # if the number is digit but a string it should work too
        html = show_duration('1500')
        eq_(
            html,
            '1,500 seconds <span class="humanized" title="1,500 seconds">'
            '(25 minutes)</span>'
        )
コード例 #12
0
 def test_show_duration_failing(self):
     html = show_duration(None)
     assert html is None
     html = show_duration("not a number")
     assert html == "not a number"
コード例 #13
0
 def test_show_duration_failing(self):
     html = show_duration(None)
     eq_(html, None)
     html = show_duration('not a number')
     eq_(html, 'not a number')
コード例 #14
0
ファイル: test_jinja_helpers.py プロジェクト: adngdb/socorro
 def test_show_duration_failing(self):
     html = show_duration(None)
     eq_(html, None)
     html = show_duration('not a number')
     eq_(html, 'not a number')
コード例 #15
0
 def test_show_duration_failing(self):
     html = show_duration(None)
     assert html is None
     html = show_duration('not a number')
     assert html == 'not a number'