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')
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')
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)
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')
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)