예제 #1
0
 def test_pickle_unity_object_exception(self):
     sa = tc.SArray()
     sf = tc.SFrame()
     g = tc.SGraph()
     sk = sa.summary()
     m = tc.pagerank.create(g)
     for obj in [sa, sf, g, sk, m]:
         self.assertRaises(PicklingError, lambda: cloudpickle.dumps(obj))
예제 #2
0
    def test_pickle_unity_object_exception(self):
        sa = tc.SArray()
        sf = tc.SFrame()
        g = tc.SGraph()
        sk = sa.summary()
        m = tc.pagerank.create(g)

        expected_error = TypeError if (version_info[0] == 3) else PicklingError

        for obj in [sa, sf, g, sk, m]:
            self.assertRaises(expected_error, lambda: cloudpickle.dumps(obj))
예제 #3
0
    def test_memoize_subclass(self):
        class A(object):
            def __init__(self):
                self.name = 'A'

        class B(A):
            def __init__(self):
                super(B, self).__init__()
                self.name2 = 'B'
        b = B()
        self.assertEqual(b.name, "A")
        self.assertEqual(b.name2, "B")

        b2 = pickle.loads(cloudpickle.dumps(b))
        self.assertEqual(b.name, b2.name)
        self.assertEqual(b.name2, b2.name2)