Mercurial > pygame
annotate test/bufferproxy_test.py @ 1849:301bc61643a9 math_module
merged changes from trunk
| author | lorenz |
|---|---|
| date | Mon, 16 Nov 2009 18:31:40 +0000 |
| parents | a6e94e964a69 |
| children | 2d7ce556083b |
| rev | line source |
|---|---|
|
1147
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
1 #################################### IMPORTS ################################### |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
2 |
|
1418
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1261
diff
changeset
|
3 if __name__ == '__main__': |
|
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1261
diff
changeset
|
4 import sys |
|
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1261
diff
changeset
|
5 import os |
|
1427
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
6 pkg_dir = os.path.split(os.path.abspath(__file__))[0] |
|
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
7 parent_dir, pkg_name = os.path.split(pkg_dir) |
|
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
8 is_pygame_pkg = (pkg_name == 'tests' and |
|
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
9 os.path.split(parent_dir)[1] == 'pygame') |
|
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
10 if not is_pygame_pkg: |
|
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
11 sys.path.insert(0, parent_dir) |
|
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
12 else: |
|
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
13 is_pygame_pkg = __name__.startswith('pygame.tests.') |
|
1147
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
14 |
|
1427
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
15 if is_pygame_pkg: |
|
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
16 from pygame.tests.test_utils import test_not_implemented, unittest |
|
a6e94e964a69
examples can be run from outside the examples directory
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
17 else: |
|
1418
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1261
diff
changeset
|
18 from test.test_utils import test_not_implemented, unittest |
|
1261
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
19 import pygame |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
20 |
|
1147
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
21 ################################################################################ |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
22 |
|
1150
69936967ecfb
Removed a few duplicate tests and added them to the gen_stubs.py blacklist. Compiled a list of Types that need instantiating before inspection.
akalias
parents:
1147
diff
changeset
|
23 class BufferProxyTypeTest(unittest.TestCase): |
|
1261
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
24 def test_creation(self): |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
25 self.assert_(pygame.bufferproxy.BufferProxy()) |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
26 |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
27 def todo_test_length(self): |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
28 |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
29 # __doc__ (as of 2008-08-02) for pygame.bufferproxy.BufferProxy.length: |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
30 |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
31 # The size of the buffer data in bytes. |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
32 |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
33 self.fail() |
|
1147
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
34 |
|
1261
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
35 def todo_test_raw(self): |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
36 |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
37 # __doc__ (as of 2008-08-02) for pygame.bufferproxy.BufferProxy.raw: |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
38 |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
39 # The raw buffer data as string. The string may contain NUL bytes. |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
40 |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
41 self.fail() |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
42 |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
43 def todo_test_write(self): |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
44 |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
45 # __doc__ (as of 2008-08-02) for pygame.bufferproxy.BufferProxy.write: |
|
1147
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
46 |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
47 # B.write (bufferproxy, buffer, offset) -> None |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
48 # |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
49 # Writes raw data to the bufferproxy. |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
50 # |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
51 # Writes the raw data from buffer to the BufferProxy object, starting |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
52 # at the specified offset within the BufferProxy. |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
53 # If the length of the passed buffer exceeds the length of the |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
54 # BufferProxy (reduced by the offset), an IndexError will be raised. |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
55 |
|
1261
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
56 self.fail() |
|
f3691359950b
Made all unimplemented tests use todo_test_xxxx naming and updated the __doc__'s. Run's only implemented tests by default.
akalias
parents:
1239
diff
changeset
|
57 |
|
1147
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
58 ################################################################################ |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
59 |
|
74ac72e14448
Added in 97 stubs to empty xxxx_test.py files. Added a few sprite collision stubs in.
akalias
parents:
1146
diff
changeset
|
60 if __name__ == '__main__': |
|
1418
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1261
diff
changeset
|
61 unittest.main() |
