def sanitize(chan: IPTVChannel) -> IPTVChannel: attr: str new_chan = chan.copy() IPTVChannelDoctor._urlencode_value(new_chan, IPTVAttr.TVG_LOGO.value) for attr in chan.attributes.keys(): IPTVChannelDoctor._convert_commas(new_chan, attr) IPTVChannelDoctor._normalize_attributes_name(new_chan, attr) return new_chan
def runTest(self): original_attributes = { IPTVAttr.TVG_ID.value: "Rai1.it", IPTVAttr.TVG_NAME.value: "Rai 1 SuperHD", IPTVAttr.TVG_LOGO.value: "https://static.epg.best/it/RaiUno.it.png", IPTVAttr.GROUP_TITLE.value: "SuperHD" } original = IPTVChannel( url="", name="Rai 1 SuperHD", duration="-1", attributes=original_attributes ) clone = original.copy() self.assertEqual(original, clone) clone.name = "my " + clone.name self.assertNotEqual(original, clone) self.assertEqual("my " + original.name, clone.name)