示例#1
0
 def test_html_to_list_should_return_list(self):
     '''Test if changes dict generated from model that has non unicode field
        is properly used by html_to_list function
     '''
     changes = get_changes_between_models(self.obj1, self.obj2)
     
     changes_list1 = html_to_list(changes['date'][0])
     changes_list2 = html_to_list(changes['date'][1])
     
     self.assertTrue(isinstance(changes_list1, list))
     self.assertTrue(isinstance(changes_list2, list))
示例#2
0
    def test_html_to_list_should_return_list(self):
        '''Test if changes dict generated from model that has non unicode field
           is properly used by html_to_list function
        '''
        changes = get_changes_between_models(self.obj1, self.obj2)

        date_change = changes['modelwithdatefield__date']

        changes_list1 = html_to_list(date_change.change[0])
        changes_list2 = html_to_list(date_change.change[1])

        self.assertTrue(isinstance(changes_list1, list))
        self.assertTrue(isinstance(changes_list2, list))
示例#3
0
 def test_html_to_list_non_ascii(self):
     html = u'<p id="test">text</p><b>Las demás lenguas españolas'\
     u' serán también</b><div class="test">text</div>'
     
     self.assertEqual(html_to_list(html), ['<p id="test">',
                                           'text',
                                           '</p>',
                                           '<b>',
                                           u'Las ',
                                           u'dem\xe1s ',
                                           u'lenguas ',
                                           u'espa\xf1olas ',
                                           u'ser\xe1n ',
                                           u'tambi\xe9n',
                                           '</b>',
                                           '<div class="test">',
                                           'text',
                                           '</div>',
                                           ])
示例#4
0
    def test_html_to_list(self):
        html = u'<p id="test">text</p><b>some long text \n\t\r text</b>'\
               u'<div class="test">text</div>'
        html_list = [u'<p id="test">',
                     u'text',
                     u'</p>',
                     u'<b>',
                     u'some ',
                     u'long ',
                     u'text ',
                     u'\n\t\r ',
                     u'text',
                     u'</b>',
                     u'<div class="test">',
                     u'text',
                     u'</div>',
                    ]

        self.assertEqual(html_to_list(html), html_list)
示例#5
0
    def test_html_to_list_non_ascii(self):
        html = '<p id="test">text</p><b>Las demás lenguas españolas'\
               ' serán también</b><div class="test">text</div>'

        self.assertEqual(html_to_list(html), [
            '<p id="test">',
            'text',
            '</p>',
            '<b>',
            'Las ',
            'dem\xe1s ',
            'lenguas ',
            'espa\xf1olas ',
            'ser\xe1n ',
            'tambi\xe9n',
            '</b>',
            '<div class="test">',
            'text',
            '</div>',
        ])
示例#6
0
    def test_html_to_list(self):
        html = '<p id="test">text</p><b>some long text \n\t\r text</b>'\
               '<div class="test">text</div>'
        html_list = [
            '<p id="test">',
            'text',
            '</p>',
            '<b>',
            'some ',
            'long ',
            'text ',
            '\n\t\r ',
            'text',
            '</b>',
            '<div class="test">',
            'text',
            '</div>',
        ]

        self.assertEqual(html_to_list(html), html_list)