summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-08 02:28:11 +0000
committerChristian Heimes <christian@cheimes.de>2007-11-08 02:28:11 +0000
commit7b6fc8e19de53fc354144d21b7a644d77ff60410 (patch)
tree4356e4d7dd4e03a9b2947cdca06d47b96b243303 /Lib
parentc1bdbc316de9a433ced7d26e8cfb3039e0768cbb (diff)
downloadcpython-git-7b6fc8e19de53fc354144d21b7a644d77ff60410.tar.gz
Fixed memoryview constructor. It allowed arbitrary keyword arguments. The bug was found by mykhal from #python. I've also added a small test case in the new test_memoryview.py
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_memoryview.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
new file mode 100644
index 0000000000..27adc5ec61
--- /dev/null
+++ b/Lib/test/test_memoryview.py
@@ -0,0 +1,25 @@
+"""Unit tests for the memoryview
+
+XXX We need more tests! Some tests are in test_bytes
+"""
+
+import unittest
+import test.test_support
+
+class MemoryviewTest(unittest.TestCase):
+
+ def test_constructor(self):
+ ob = b'test'
+ self.assert_(memoryview(ob))
+ self.assert_(memoryview(object=ob))
+ self.assertRaises(TypeError, memoryview)
+ self.assertRaises(TypeError, memoryview, ob, ob)
+ self.assertRaises(TypeError, memoryview, argument=ob)
+ self.assertRaises(TypeError, memoryview, ob, argument=True)
+
+def test_main():
+ test.test_support.run_unittest(MemoryviewTest)
+
+
+if __name__ == "__main__":
+ test_main()