import unittest from uri.uri import URI class OfferTest (unittest.TestCase) : u1=URI("http://blabla") u1a=URI("hTTP://blaBla") u2=URI("ws://localhost:8080/bla/2/3?q=hello#zozo") def testGetUri(self): self.assertEqual("ws://localhost:8080/bla/2/3?q=hello#zozo", self.u2.getUri()) def testRepr(self): self.assertEqual("ws://localhost:8080/bla/2/3?q=hello#zozo", repr(self.u2)) def testGetHost(self): self.assertEqual("localhost", self.u2.getHost()) def testGetScheme(self): self.assertEqual("ws", self.u2.getScheme()) def testGetFragment(self): self.assertEqual("zozo", self.u2.getFragment()) def testGetQuery(self): self.assertEqual("q=hello", self.u2.getQuery()) def testHashEq(self): self.assertEqual(self.u1, self.u1a) self.assertEqual(hash(self.u1), hash(self.u1a)) # def testRaisesError(self): # self.assertRaises(AssertionError, lambda:URI("!")) # self.assertRaises(AssertionError, lambda:URI("path")) #