import unittest
import numpy as np
from IPython.parallel import Client
from distarray.client import DistArrayContext


class TestDistArrayContext(unittest.TestCase):

    def setUp(self):
        self.client = Client()
        self.dv = self.client[:]

    def test_create_DAC(self):
        '''Can we create a plain vanilla context?'''
        dac = DistArrayContext(self.dv)
        self.assertIs(dac.view, self.dv)

    def test_create_DAC_with_targets(self):
        '''Can we create a context with a subset of engines?'''
        dac = DistArrayContext(self.dv, targets=[0, 1])
        self.assertIs(dac.view, self.dv)


class TestDistArrayProxy(unittest.TestCase):

    def setUp(self):
        self.client = Client()
        self.dv = self.client[:]
        self.dac = DistArrayContext(self.dv)

        self.dap = self.dac.fromndarray(np.arange(100))

    def test_getitem(self):
        self.assertEqual(self.dap[55], 55)


if __name__ == '__main__':
    unittest.main(verbosity=2)

import unittest
import numpy as np
from IPython.parallel import Client
from distarray.client import DistArrayContext


class TestDistArrayContext(unittest.TestCase):

    def setUp(self):
        self.client = Client()
        self.dv = self.client[:]

    def test_create_DAC(self):
        '''Can we create a plain vanilla context?'''
        dac = DistArrayContext(self.dv)
        self.assertIs(dac.view, self.dv)

    def test_create_DAC_with_targets(self):
        '''Can we create a context with a subset of engines?'''
        dac = DistArrayContext(self.dv, targets=[0, 1])
        self.assertIs(dac.view, self.dv)


class TestDistArrayProxy(unittest.TestCase):

    def setUp(self):
        self.client = Client()
        self.dv = self.client[:]
        self.dac = DistArrayContext(self.dv)

        self.dap = self.dac.fromndarray(np.arange(100))

    def test_getitem(self):
        self.assertEqual(self.dap[55], 55)

    def test_setitem(self):
        self.dap[35] = 9999
        print self.dap[35]


if __name__ == '__main__':
    unittest.main(verbosity=2)

Add failing test for DistArrayProxy.__setitem__
Add failing test for DistArrayProxy.__setitem__