Esempio n. 1
0
    def test_create_multiple_context(self):
        # Creating multiple contexts in sequence but open at the same time is okay.
        a = SystemDSContext()
        b = SystemDSContext()
        c = SystemDSContext()
        d = SystemDSContext()

        a.close()
        b.close()
        c.close()
        d.close()
Esempio n. 2
0
                                category=ResourceWarning)

    def test_lm(self):
        X = np.random.rand(shape[0], shape[1])
        y = np.random.rand(shape[0], 1)

        try:
            sds_model_weights = sds.matrix(X).lm(sds.matrix(y)).compute()
            model = regressor.fit(X, y)

            model.coef_ = model.coef_.reshape(sds_model_weights.shape)
            self.assertTrue(np.allclose(sds_model_weights, model.coef_, eps))
        except Exception as e:
            print(e)
            self.assertTrue(False, "This should not raise an exception!")

    def test_lm_invalid_shape(self):
        X = np.random.rand(shape[0], 0)
        y = np.random.rand(0, 1)

        try:
            sds_model_weights = sds.matrix(X).lm(sds.matrix(y)).compute()
            self.assertTrue(False, "An exception was expected!")
        except Exception as e:
            print(e)


if __name__ == "__main__":
    unittest.main(exit=False)
    sds.close()
Esempio n. 3
0
 def test_same_port(self):
     # Same port should graciously change port
     sds1 = SystemDSContext(port=9415)
     sds2 = SystemDSContext(port=9415)
     sds1.close()
     sds2.close()