def test_formatting(self):
     server = MriServerDispatch({'id': 'abcde'}, HTTP_BIN, 'test', 'tester')
     event = TrainingEvent({'iteration': 100, 'loss': 200, 'accuracy': 300}, 'iteration')
     data = server._format_train_request(event)
     correct = json.dumps(
         {"type": "train.abcde", "properties": {"iteration": 100, "loss": 200, "accuracy": 300}}
     )
     self.assertEqual(data, correct)
 def test_format_train_request(self):
     server = MriServerDispatch({'title': 'test', 'id': 'cbdcig'}, HTTP_BIN, 'test', 'tester')
     event = TrainingEvent({'iteration': 100, 'loss': 0.5, 'accuracy': 0.6}, 'iteration')
     payload = server._format_train_request(event)
     self.assertTrue('train.cbdcig' in payload)
     self.assertTrue('"accuracy": 0.6' in payload)