def test_add_period(self): text = Tag('em', Text("That's all, folks")) assert text.add_period().render_as( 'html') == "<em>That's all, folks.</em>" assert text.add_period().add_period().render_as( 'html') == "<em>That's all, folks.</em>" text = Text("That's all, ", Tag('em', 'folks')) assert text.add_period().render_as( 'html') == "That's all, <em>folks</em>." assert text.add_period().add_period().render_as( 'html') == "That's all, <em>folks</em>." text = Text("That's all, ", Tag('em', 'folks.')) assert text.add_period().render_as( 'html') == "That's all, <em>folks.</em>" text = Text("That's all, ", Tag('em', 'folks')) assert text.add_period('!').render_as( 'html') == "That's all, <em>folks</em>!" text = text.add_period('!').add_period('.').render_as('html') assert text == "That's all, <em>folks</em>!" tag = Tag('em', Text(), Text('mary ', 'had ', 'a little lamb')) assert tag.add_period().render_as( 'html') == '<em>mary had a little lamb.</em>' assert tag.add_period().add_period().render_as( 'html') == '<em>mary had a little lamb.</em>'
def test__unicode__(self): empty = Tag('em') assert unicode(empty.lower()) == '' assert unicode(empty.capitalize()) == '' assert unicode(empty.add_period()) == '' assert unicode(Tag('strong', u'ねここねこ')) == u'ねここねこ'
def test__str__(self): empty = Tag('em') assert six.text_type(empty.lower()) == '' assert six.text_type(empty.capitalize()) == '' assert six.text_type(empty.add_period()) == '' assert six.text_type(Tag('strong', u'ねここねこ')) == u'ねここねこ'
def test__unicode__(self): empty = Tag('em') assert unicode(empty.lower()) == '' assert unicode(empty.capitalize()) == '' assert unicode(empty.add_period()) == '' assert unicode(Tag('strong', u'ねここねこ')) == u'ねここねこ'
def test_add_period(self): text = Tag('em', Text("That's all, folks")) assert text.add_period().render_as('html') == "<em>That's all, folks.</em>" assert text.add_period().add_period().render_as('html') == "<em>That's all, folks.</em>" text = Text("That's all, ", Tag('em', 'folks')) assert text.add_period().render_as('html') == "That's all, <em>folks</em>." assert text.add_period().add_period().render_as('html') == "That's all, <em>folks</em>." text = Text("That's all, ", Tag('em', 'folks.')) assert text.add_period().render_as('html') == "That's all, <em>folks.</em>" text = Text("That's all, ", Tag('em', 'folks')) assert text.add_period('!').render_as('html') == "That's all, <em>folks</em>!" text = text.add_period('!').add_period('.').render_as('html') assert text == "That's all, <em>folks</em>!" tag = Tag('em', Text(), Text('mary ', 'had ', 'a little lamb')) assert tag.add_period().render_as('html') == '<em>mary had a little lamb.</em>' assert tag.add_period().add_period().render_as('html') == '<em>mary had a little lamb.</em>'