Exemplo n.º 1
0
    def testNormalAuthorShouldHaveNoExtensionElements(self):
        self.author.name = atom.Name(text='Jeff Scudder')
        self.assert_(self.author.name.text == 'Jeff Scudder')
        self.assert_(len(self.author.extension_elements) == 0)
        new_author = atom.AuthorFromString(self.author.ToString())
        self.assert_(len(self.author.extension_elements) == 0)

        self.author.extension_elements.append(
            atom.ExtensionElement('foo', text='bar'))
        self.assert_(len(self.author.extension_elements) == 1)
        self.assert_(self.author.name.text == 'Jeff Scudder')
        new_author = atom.AuthorFromString(self.author.ToString())
        self.assert_(len(self.author.extension_elements) == 1)
        self.assert_(new_author.name.text == 'Jeff Scudder')
Exemplo n.º 2
0
 def testExtensionElements(self):
     self.author.extension_attributes['foo1'] = 'bar'
     self.author.extension_attributes['foo2'] = 'rab'
     self.assert_(self.author.extension_attributes['foo1'] == 'bar')
     self.assert_(self.author.extension_attributes['foo2'] == 'rab')
     new_author = atom.AuthorFromString(self.author.ToString())
     self.assert_(new_author.extension_attributes['foo1'] == 'bar')
     self.assert_(new_author.extension_attributes['foo2'] == 'rab')
Exemplo n.º 3
0
 def testAuthorWithNameToAndFromStringShouldMatch(self):
     self.author.name = atom.Name()
     self.author.name.text = 'Jeff Scudder'
     string_from_author = self.author.ToString()
     new_author = atom.AuthorFromString(string_from_author)
     string_from_new_author = new_author.ToString()
     self.assert_(string_from_author == string_from_new_author)
     self.assert_(self.author.name.text == new_author.name.text)
Exemplo n.º 4
0
 def testConvertFullAuthorToAndFromString(self):
     author = atom.AuthorFromString(test_data.TEST_AUTHOR)
     self.assert_(author.name.text == 'John Doe')
     self.assert_(author.email.text == '*****@*****.**')
     self.assert_(author.uri.text == 'http://www.google.com')
Exemplo n.º 5
0
 def testEmptyAuthorToAndFromStringShouldMatch(self):
     string_from_author = self.author.ToString()
     new_author = atom.AuthorFromString(string_from_author)
     string_from_new_author = new_author.ToString()
     self.assert_(string_from_author == string_from_new_author)