2007-11-07 22:28:11 -04:00
|
|
|
"""Unit tests for the memoryview
|
|
|
|
|
|
|
|
XXX We need more tests! Some tests are in test_bytes
|
|
|
|
"""
|
|
|
|
|
|
|
|
import unittest
|
2008-05-20 18:35:26 -03:00
|
|
|
import test.support
|
2007-11-07 22:28:11 -04:00
|
|
|
|
|
|
|
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():
|
2008-05-20 18:35:26 -03:00
|
|
|
test.support.run_unittest(MemoryviewTest)
|
2007-11-07 22:28:11 -04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
test_main()
|