Staging
v0.8.1
https://github.com/python/cpython
Raw File
Tip revision: 27423b8bff31763486e1e4830a20302c362d4cf7 authored by Guido van Rossum on 06 December 2007, 19:19:54 UTC
Tagging 3.0a2 for release. Fingers crossed.
Tip revision: 27423b8
test_memoryview.py
"""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()
back to top