def test_3(self): string = ",,," expected = [] result = "" obj = SRCSet(string) self.assertEqual(obj.parse(), expected) self.assertEqual(obj.stringify(), result)
def test_9(self): string = "\u000Ddata:,a\u000D1x\u000D".decode("unicode-escape") expected = [{"url": "data:,a", "x": "1", "w": None, "h": None}] result = "data:,a 1x" obj = SRCSet(string) self.assertEqual(obj.parse(), expected) self.assertEqual(obj.stringify(), result)
def test_5(self): string = "\t\tdata:,a\t\t1x\t\t" expected = [{"url": "data:,a", "x": "1", "w": None, "h": None}] result = "data:,a 1x" obj = SRCSet(string) self.assertEqual(obj.parse(), expected) self.assertEqual(obj.stringify(), result)
def test_5(self): string = "data:,a ((( , data:,b 1x, ), data:,c" expected = [{"url": "data:,c", "x": None, "w": None, "h": None}] result = "data:,c" obj = SRCSet(string) self.assertEqual(obj.parse(), expected) self.assertEqual(obj.stringify(), result)
def test_22(self): string = "data:,a " expected = [{"url": "data:,a ", "x": None, "w": None, "h": None}] result = "data:,a " obj = SRCSet(string) self.assertEqual(obj.parse(), expected) self.assertEqual(obj.stringify(), result)
def test_channel(self): string = "//www.chanel.com/images/q_auto,f_auto,fl_lossy,dpr_auto/w_128/FSH-18aegamenucollection.jpg" expected = [{"url": string, "w": None, "h": None, "x": None}] result = string obj = SRCSet(string) self.assertEqual(obj.parse(), expected) self.assertEqual(obj.stringify(), result)
def test_65(self): string = "data:,a +1x" expected = [] result = "" obj = SRCSet(string) obj.parse() self.assertEqual(obj.candidates, expected) self.assertEqual(obj.stringify(), result)
def test_63(self): string = "data:,a 1.0x" expected = [{"url": "data:,a", "x": "1.0", "w": None, "h": None}] result = "data:,a 1.0x" obj = SRCSet(string) obj.parse() self.assertEqual(obj.candidates, expected) self.assertEqual(obj.stringify(), result)
def test_16(self): string = "data:,a /*, data:,b, data:,c */" expected = [{"url": "data:,b", "x": None, "w": None, "h": None}] result = "data:,b" obj = SRCSet(string) obj.parse() self.assertEqual(obj.candidates, expected) self.assertEqual(obj.stringify(), result)
def test_10(self): string = "\u000Edata:,a\u000E1x\u000E".decode("unicode-escape") expected = [{ "url": "\x0edata:,a\x0e1x\x0e", "x": None, "w": None, "h": None }] result = "\x0edata:,a\x0e1x\x0e" obj = SRCSet(string) self.assertEqual(obj.parse(), expected) self.assertEqual(obj.stringify(), result)
def test_7(self): string = "\u000B\u000Bdata:,a\u000B\u000B1x\u000B\u000B".decode( "unicode-escape") expected = [{ "url": "\x0b\x0bdata:,a\x0b\x0b1x\x0b\x0b", "x": None, "w": None, "h": None }] result = "\x0b\x0bdata:,a\x0b\x0b1x\x0b\x0b" obj = SRCSet(string) self.assertEqual(obj.parse(), expected) self.assertEqual(obj.stringify(), result)
def test_9(self): string = "data:,a ,data:;,b, data:,c" expected = [{ "url": "data:,a", "x": None, "w": None, "h": None }, { "url": 'data:;,b', "x": None, "w": None, "h": None }, { "url": "data:,c", "x": None, "w": None, "h": None }] result = "data:,a, data:;,b, data:,c" obj = SRCSet(string) obj.parse() self.assertEqual(obj.candidates, expected) self.assertEqual(obj.stringify(), result)
def test_8(self): string = 'data:,a " , data:,b 1x, ", data:,c' expected = [{ "url": "data:,b", "x": "1", "w": None, "h": None }, { "url": '"', "x": None, "w": None, "h": None }, { "url": "data:,c", "x": None, "w": None, "h": None }] result = "data:,b 1x, \", data:,c" obj = SRCSet(string) obj.parse() self.assertEqual(obj.candidates, expected) self.assertEqual(obj.stringify(), result)
def benchmark(): SRCSet(" data:,a 1x , data:c qw").parse()