Last change
on this file since 297 was 297, checked in by wouter, 3 years ago |
#100 uri is now uri.uri ...... because of shit with setup.py typing hints
|
File size:
1.0 KB
|
Line | |
---|
1 | import unittest
|
---|
2 | from uri.uri import URI
|
---|
3 |
|
---|
4 | class OfferTest (unittest.TestCase) :
|
---|
5 | u1=URI("http://blabla")
|
---|
6 | u1a=URI("hTTP://blaBla")
|
---|
7 | u2=URI("ws://localhost:8080/bla/2/3?q=hello#zozo")
|
---|
8 |
|
---|
9 | def testGetUri(self):
|
---|
10 | self.assertEqual("ws://localhost:8080/bla/2/3?q=hello#zozo", self.u2.getUri())
|
---|
11 |
|
---|
12 | def testRepr(self):
|
---|
13 | self.assertEqual("ws://localhost:8080/bla/2/3?q=hello#zozo", repr(self.u2))
|
---|
14 |
|
---|
15 | def testGetHost(self):
|
---|
16 | self.assertEqual("localhost", self.u2.getHost())
|
---|
17 |
|
---|
18 | def testGetScheme(self):
|
---|
19 | self.assertEqual("ws", self.u2.getScheme())
|
---|
20 |
|
---|
21 | def testGetFragment(self):
|
---|
22 | self.assertEqual("zozo", self.u2.getFragment())
|
---|
23 |
|
---|
24 | def testGetQuery(self):
|
---|
25 | self.assertEqual("q=hello", self.u2.getQuery())
|
---|
26 |
|
---|
27 | def testHashEq(self):
|
---|
28 | self.assertEqual(self.u1, self.u1a)
|
---|
29 | self.assertEqual(hash(self.u1), hash(self.u1a))
|
---|
30 |
|
---|
31 | # def testRaisesError(self):
|
---|
32 | # self.assertRaises(AssertionError, lambda:URI("!"))
|
---|
33 | # self.assertRaises(AssertionError, lambda:URI("path"))
|
---|
34 | # |
---|
Note:
See
TracBrowser
for help on using the repository browser.