annotate Lib/test/test_SimpleHTTPServer.py @ 58765:2ba7677bfa95 legacy-trunk

testCopysign was defined twice in test_math; combine the definitions
author Mark Dickinson <dickinsm@gmail.com>
date Sat, 06 Feb 2010 23:11:25 +0000
parents 0e92ef57c0d4
children 9c930a32cebb 614c84670c63
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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')
0e92ef57c0d4 Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff changeset
24 self.assertEquals (path, self.translated)
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')
0e92ef57c0d4 Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff changeset
26 self.assertEquals (path, self.translated)
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')
0e92ef57c0d4 Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff changeset
28 self.assertEquals (path, self.translated)
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')
0e92ef57c0d4 Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff changeset
32 self.assertEquals (path, self.translated)
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')
0e92ef57c0d4 Issue 1224. Now we support again the double slash in the URL.
Facundo Batista <facundobatista@gmail.com>
parents:
diff changeset
34 self.assertEquals (path, self.translated)
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()