Exemple #1
0
    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__)
Exemple #2
0
 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)
Exemple #3
0
 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)
Exemple #4
0
 def test_flatstring(self):
     psl = PublicSuffixList(u("com\nnet\n"))
     self.assertEqual(psl.publicsuffix("example.com"), "com")
Exemple #5
0
 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)
Exemple #6
0
 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)
Exemple #7
0
    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__)
Exemple #8
0
 def test_flatstring(self):
     psl = PublicSuffixList(u("com\nnet\n"))
     self.assertEqual(psl.publicsuffix("example.com"), "com")