cpython/Lib/test/test_memoryview.py

26 lines
650 B
Python

"""Unit tests for the memoryview
XXX We need more tests! Some tests are in test_bytes
"""
import unittest
import 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.support.run_unittest(MemoryviewTest)
if __name__ == "__main__":
test_main()