def testEqual(self): feed = Feed() feed.title = self.feed.title feed.updated = self.feed.updated feed.entries = self.feed.entries feed.url = self.feed.url feed.homepage = self.feed.homepage feed.author = self.feed.author self.assertEqual(self.feed, feed)
def createFeedFromData(data, entryclz=Entry): if data["bozo"] == 1: return None feed = Feed() if "title" in data["feed"]: feed.title = data["feed"]["title"] else: feed.title = "No Title provided" if "links" in data["feed"]: for link in data["feed"]["links"]: if "rel" in link and link["rel"] == "self": feed.url = link["href"] if "link" in data["feed"]: feed.homepage = data["feed"]["link"] if "author" in data["feed"]: feed.author = data["feed"]["author"] else: feed.author = "No Author provided" if "updated_parsed" in data["feed"]: feed.updated = data["feed"]["updated_parsed"] for edata in data["entries"]: feed.entries.append(createEntryFromData(data=edata, entryclz=entryclz)) return feed