def test_json(self):
     """
     Tests the json methods.
     """
     actor = control.Flow()
     actor.name = "blah"
     actor.config["annotation"] = "Some annotation text"
     actor.actors.append(source.Start())
     tee = control.Tee()
     actor.actors.append(tee)
     tee.actors.append(sink.Console())
     trigger = control.Trigger()
     actor.actors.append(trigger)
     files = source.FileSupplier()
     files.config["files"] = ["file1.arff", "file2.arff"]
     trigger.actors.append(files)
     loader = transformer.LoadDataset()
     trigger.actors.append(loader)
     select = transformer.ClassSelector()
     trigger.actors.append(select)
     train = transformer.Train()
     train.config["setup"] = classifiers.Classifier(
         classname="weka.classifiers.trees.J48", options=["-C", "0.3"])
     trigger.actors.append(train)
     json = actor.to_json()
     flow2 = control.Flow.from_json(json)
     json2 = flow2.to_json()
     self.assertEqual(json, json2, msg="JSON representations differ")
 def test_shallow_copy(self):
     """
     Tests the shallow_copy method.
     """
     actor = control.Flow()
     actor.name = "blah"
     actor.config["annotation"] = "Some annotation text"
     actor2 = actor.shallow_copy()
     self.assertEqual(actor.name, actor2.name, msg="Names differ")
     self.assertEqual(actor.config, actor2.config, msg="Configs differ")
 def test_instantiation(self):
     """
     Tests instantiating of control actors.
     """
     actor = control.Flow()
     self.assertIsNotNone(actor, msg="Actor should not be None")