<commit_before>from mpi4py import MPI
import mpiunittest as unittest
import sys

class TestMemory(unittest.TestCase):

    def testNewEmpty(self):
        memory = MPI.memory
        mem = memory()
        self.assertEqual(mem.address, 0)
        self.assertEqual(mem.nbytes, 0)
        self.assertFalse(mem.readonly)
        self.assertEqual(len(mem), 0)
        mem[:] = 0
        mem[:] = memory()
        if sys.version_info < (3,):
            b = buffer(mem)
            self.assertEqual(len(b), 0)
        if sys.version_info >= (2,7):
            m = memoryview(mem)
            self.assertEqual(m.format, 'B')
            self.assertEqual(m.itemsize, 1)
            self.assertEqual(m.ndim, 1)
            if not hasattr(sys, 'pypy_version_info'):
                self.assertEqual(m.readonly, False)
            self.assertEqual(m.shape, (0,))
            self.assertEqual(m.strides, (1,))
            self.assertEqual(m.tobytes(), b"")
            self.assertEqual(m.tolist(), [])
        mem.release()
        self.assertEqual(mem.address, 0)
        self.assertEqual(mem.nbytes, 0)
        self.assertFalse(mem.readonly)

    def testFromBufferBytes(self):
        memory = MPI.memory
        mem = memory.frombuffer(b"abc", readonly=True)<commit_msg>test: Disable memoryview test failing with Py3.2<commit_after>from mpi4py import MPI
import mpiunittest as unittest
import sys

class TestMemory(unittest.TestCase):

    def testNewEmpty(self):
        memory = MPI.memory
        mem = memory()
        self.assertEqual(mem.address, 0)
        self.assertEqual(mem.nbytes, 0)
        self.assertFalse(mem.readonly)
        self.assertEqual(len(mem), 0)
        mem[:] = 0
        mem[:] = memory()
        if sys.version_info < (3,0):
            b = buffer(mem)
            self.assertEqual(len(b), 0)
        if (sys.version_info == (2,7) or
            sys.version_info >= (3,3)):
            m = memoryview(mem)
            self.assertEqual(m.format, 'B')
            self.assertEqual(m.itemsize, 1)
            self.assertEqual(m.ndim, 1)
            if not hasattr(sys, 'pypy_version_info'):
                self.assertEqual(m.readonly, False)
            self.assertEqual(m.shape, (0,))
            self.assertEqual(m.strides, (1,))
            self.assertEqual(m.tobytes(), b"")
            self.assertEqual(m.tolist(), [])
        mem.release()
        self.assertEqual(mem.address, 0)
        self.assertEqual(mem.nbytes, 0)
        self.assertFalse(mem.readonly)

    def testFromBufferBytes(self):
        memory = MPI.memory
        mem = memory.frombuffer(b"abc", readonly=True)
{'fraction_non_alphanumeric': 0.12821497120921305, 'fraction_numerical': 0.013435700575815739, 'mean_word_length': 2.106078665077473, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2055039', 'n_tokens_mistral': 825, 'n_tokens_neox': 789, 'n_words': 154}