示例#1
0
 def test_SmartURL_seed(self):
     """ SmartURL has a seed. The seed doesn't change when splitted or composed change."""
     url=SmartURL("http://foo.com/blah_blah_(wikipedia)")
     seed=copy.copy(url.Seed)
     url.Composed="http://foo.com/blah_blah"
     self.assertEqual(seed,url.Seed)
     url=SmartURL("http://foo.com/blah_blah_(wikipedia)")
     url.Splitted=["http:","","foo.com","blah_blah","(nonsense)"]
     self.assertEqual(seed,url.Seed)
示例#2
0
 def test_SmartURL_changes(self):
     """SmartURL: If either splitted or composed changes, the other changes accordingly."""
     url=SmartURL("http://foo.com/blah_blah_(wikipedia)")
     url.Composed="http://bar.com/blah_blah_(wikipedia)"
     self.assertEqual(url.Composed,"http://bar.com/blah_blah_(wikipedia)") # 026 First check if Composed was really changed.
     self.assertEqual(["http:","","bar.com","blah_blah_(wikipedia)"],url.Splitted) # 026 Then check if the change was reflected by Splitted.
     url=SmartURL("http://www.kosek.cz/clanky/swn-xml/ar02s17.html")
     url.Splitted=["http:","","www.vrabec.cz","clanky","swn-xml","ar03s18.html"]
     self.assertEqual(url.Splitted,["http:","","www.vrabec.cz","clanky","swn-xml","ar03s18.html"]) # 026 First check if Splitted was really changed.
     self.assertEqual(url.Composed,"http://www.vrabec.cz/clanky/swn-xml/ar03s18.html") # 026 Then check if the change was reflected by Composed.