def test_typesafe(self): self.assertEqual( self.psl.suffix("www.example.co.jp").__class__, "example.co.jp".__class__) self.assertEqual( self.psl.suffix(u("www.example.co.jp")).__class__, u("example.co.jp").__class__) self.assertEqual( self.psl.publicsuffix("www.example.co.jp").__class__, "co.jp".__class__) self.assertEqual( self.psl.publicsuffix(u("www.example.co.jp")).__class__, u("co.jp").__class__)
def test_punycoded(self): tld = encode_idn(u("香港")) self.assertEqual(self.psl.suffix(u("www.example.") + tld), u("example.") + tld) self.assertEqual(self.psl.publicsuffix(u("www.example.") + tld), tld)
def test_idn(self): tld = u("香港") self.assertEqual(self.psl.suffix(u("www.example.") + tld), u("example.") + tld) self.assertEqual(self.psl.publicsuffix(u("www.example.") + tld), tld)
def test_flatstring(self): psl = PublicSuffixList(u("com\nnet\n")) self.assertEqual(psl.publicsuffix("example.com"), "com")
def test_typesafe(self): self.assertEqual(self.psl.suffix("www.example.co.jp").__class__, "example.co.jp".__class__) self.assertEqual(self.psl.suffix(u("www.example.co.jp")).__class__, u("example.co.jp").__class__) self.assertEqual(self.psl.publicsuffix("www.example.co.jp").__class__, "co.jp".__class__) self.assertEqual(self.psl.publicsuffix(u("www.example.co.jp")).__class__, u("co.jp").__class__)