def test_build_dataset_fn(self):
     x, y = my_fn.build_dataset(2, 8, 0.1)
     self.assertEqual(len(x.shape), 2, 'wrong dimensions of points')
     self.assertEqual(len(y.shape), 1, 'wrong dimensions of labels')
     self.assertEqual(x.shape[0], 8, 'wrong number of points')
     self.assertEqual(y.shape[0], 8, 'wrong number of labels')
     for xx in x:
         self.assertEqual(len(xx), 2, 'wrong number of coordinates')
     for yy in y:
         self.assertTrue(yy==1 or yy==0, 'wrong label')
 def test_get_dataset_fn1(self):
     x, y = my_fn.build_dataset(2, 8, 0.1)
     for client_id in [0,1]:
         x_c, y_c = my_fn.get_client_dataset(client_id, 2, x, y)
         self.assertEqual(len(x_c.shape), 2, 'wrong dimensions of points')
         self.assertEqual(len(y_c.shape), 1, 'wrong dimensions of labels')
         self.assertEqual(x_c.shape[0], 4, 'wrong number of points')
         self.assertEqual(y_c.shape[0], 4, 'wrong number of labels')
         for xx in x_c:
             self.assertEqual(len(xx), 2, 'wrong number of coordinates')
         for yy in y_c:
             self.assertTrue(yy==1 or yy==0, 'wrong label')
 def test_get_dataset_fn4(self):
     x, _ = my_fn.build_dataset(2, 8, 0.1)
     with self.assertRaises(TypeError):
         my_fn.get_client_dataset(0, 2, x, np.array([]))
 def test_get_dataset_fn2(self):
     x, y = my_fn.build_dataset(2, 8, 0.1)
     with self.assertRaises(TypeError):
         my_fn.get_client_dataset(-1, 2, x, y)