Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_SimpleHTTPServer.py @ 80661:94de77bd0b4b 2.7
Issue #16194: document imp.load_dynamic problems
when read several extension modules from the same binary object file.
| author | Andrew Svetlov <andrew.svetlov@gmail.com> |
|---|---|
| date | Thu, 29 Nov 2012 19:51:28 +0200 |
| parents | 614c84670c63 |
| children |
| rev | line source |
|---|---|
|
45387
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
1 """ |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
2 These tests only check url parsing for now. |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
3 We don't want to require the 'network' resource. |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
4 """ |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
5 |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
6 import os, unittest |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
7 from SimpleHTTPServer import SimpleHTTPRequestHandler |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
8 from test import test_support |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
9 |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
10 |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
11 class SocketlessRequestHandler (SimpleHTTPRequestHandler): |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
12 def __init__(self): |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
13 pass |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
14 |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
15 class SimpleHTTPRequestHandlerTestCase(unittest.TestCase): |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
16 """ Test url parsing """ |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
17 def setUp (self): |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
18 self.translated = os.getcwd() |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
19 self.translated = os.path.join(self.translated, 'filename') |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
20 self.handler = SocketlessRequestHandler () |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
21 |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
22 def test_queryArguments (self): |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
23 path = self.handler.translate_path ('/filename') |
|
66348
614c84670c63
Merged revisions 86596 via svnmerge from
Ezio Melotti <ezio.melotti@gmail.com>
parents:
45387
diff
changeset
|
24 self.assertEqual (path, self.translated) |
|
45387
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
25 path = self.handler.translate_path ('/filename?foo=bar') |
|
66348
614c84670c63
Merged revisions 86596 via svnmerge from
Ezio Melotti <ezio.melotti@gmail.com>
parents:
45387
diff
changeset
|
26 self.assertEqual (path, self.translated) |
|
45387
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
27 path = self.handler.translate_path ('/filename?a=b&spam=eggs#zot') |
|
66348
614c84670c63
Merged revisions 86596 via svnmerge from
Ezio Melotti <ezio.melotti@gmail.com>
parents:
45387
diff
changeset
|
28 self.assertEqual (path, self.translated) |
|
45387
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
29 |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
30 def test_startWithDoubleSlash (self): |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
31 path = self.handler.translate_path ('//filename') |
|
66348
614c84670c63
Merged revisions 86596 via svnmerge from
Ezio Melotti <ezio.melotti@gmail.com>
parents:
45387
diff
changeset
|
32 self.assertEqual (path, self.translated) |
|
45387
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
33 path = self.handler.translate_path ('//filename?foo=bar') |
|
66348
614c84670c63
Merged revisions 86596 via svnmerge from
Ezio Melotti <ezio.melotti@gmail.com>
parents:
45387
diff
changeset
|
34 self.assertEqual (path, self.translated) |
|
45387
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
35 |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
36 |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
37 def test_main(): |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
38 test_support.run_unittest(SimpleHTTPRequestHandlerTestCase) |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
39 |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
40 if __name__ == "__main__": |
|
0e92ef57c0d4
Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff
changeset
|
41 test_main() |
