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 <script> ' '<span class="humanized" title="150 <script>">' '(2 minutes and 30 seconds)</span>')
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 <script> " '<span class="humanized" title="150 <script>">' "(2 minutes and 30 seconds)</span>") assert html == expected
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 <script> ' '<span class="humanized" title="150 <script>">' '(2 minutes and 30 seconds)</span>' ) assert html == expected
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 <script> ' '<span class="humanized" title="150 <script>">' '(2 minutes and 30 seconds)</span>' )
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
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>')
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
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>')
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>' )
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
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>' )
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"
def test_show_duration_failing(self): html = show_duration(None) eq_(html, None) html = show_duration('not a number') eq_(html, 'not a number')
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'