def test_get_neurons(self): """ Test to get neurons from the brainLoader scenarii: - 1/ get a simple neuron from the brainloader - 2/ get a neuron with global variables as parameters """ # 1/ get a simple neuron from the brainloader st = Settings() neuron_list = [{'say': {'message': ['test message']}}] neuron = Neuron(name='say', parameters={'message': ['test message']}) bl = BrainLoader(file_path=self.brain_to_test) neurons_from_brain_loader = bl._get_neurons(neuron_list, settings=st) self.assertEqual([neuron], neurons_from_brain_loader) # 2/ get a neuron with global variables as parameters neuron_list = [{'say': {'message': ['bonjour {{name}}']}}] variables = {"author": "Lamonf", "test_number": 60, "name": "kalliope"} st = Settings(variables=variables) bl = BrainLoader(file_path=self.brain_to_test) neurons_from_brain_loader = bl._get_neurons(neuron_list, settings=st) neuron = Neuron(name='say', parameters={'message': ['bonjour kalliope']}) self.assertEqual([neuron], neurons_from_brain_loader)
def test_get_neurons(self): neuron_list = [{'say': {'message': ['test message']}}] neuron = Neuron(name='say', parameters={'message': ['test message']}) bl = BrainLoader(file_path=self.brain_to_test) neurons_from_brain_loader = bl._get_neurons(neuron_list) self.assertEqual([neuron], neurons_from_brain_loader)
def test_get_neurons(self): """ Test to get neurons from the brainLoader scenarii: - 1/ get a simple neuron from the brainloader - 2/ get a neuron with brackets - 3/ get a neuron with int as parameters """ # 1/ get a simple neuron from the brainloader st = Settings() neuron_list = [{'say': {'message': ['test message']}}] neuron = Neuron(name='say', parameters={'message': ['test message']}) bl = BrainLoader(file_path=self.brain_to_test) neurons_from_brain_loader = bl._get_neurons(neuron_list, settings=st) self.assertEqual([neuron], neurons_from_brain_loader) # 2/ get a neuron with global variables as parameters neuron_list = [{'say': {'message': ['bonjour {{name}}']}}] st = Settings() bl = BrainLoader(file_path=self.brain_to_test) neurons_from_brain_loader = bl._get_neurons(neuron_list, settings=st) neuron = Neuron(name='say', parameters={'message': ['bonjour {{name}}']}) self.assertEqual([neuron], neurons_from_brain_loader) # 3/ get a neuron with int as parameters st = Settings() neuron_list = [{'sleep': {'seconds': 60}}] neuron = Neuron(name='sleep', parameters={'seconds': 60}) bl = BrainLoader(file_path=self.brain_to_test) neurons_from_brain_loader = bl._get_neurons(neuron_list, settings=st) self.assertEqual([neuron], neurons_from_brain_loader)
def test_get_neurons(self): """ Test to get neurons from the brainLoader scenarii: - 1/ get a simple neuron from the brainloader - 2/ get a neuron with brackets - 3/ get a neuron with int as parameters """ # 1/ get a simple neuron from the brainloader st = Settings() neuron_list = [{'say': {'message': ['test message']}}] neuron = Neuron(name='say', parameters={'message': ['test message']}) bl = BrainLoader(file_path=self.brain_to_test) neurons_from_brain_loader = bl._get_neurons(neuron_list, settings=st) self.assertEqual([neuron], neurons_from_brain_loader) # 2/ get a neuron with global variables as parameters neuron_list = [{'say': {'message': ['bonjour {{name}}']}}] st = Settings() bl = BrainLoader(file_path=self.brain_to_test) neurons_from_brain_loader = bl._get_neurons(neuron_list, settings=st) neuron = Neuron(name='say', parameters={'message': ['bonjour {{name}}']}) self.assertEqual([neuron], neurons_from_brain_loader) # 3/ get a neuron with int as parameters st = Settings() neuron_list = [{'sleep': {'seconds': 60}}] neuron = Neuron(name='sleep', parameters={'seconds': 60}) bl = BrainLoader(file_path=self.brain_to_test) neurons_from_brain_loader = bl._get_neurons(neuron_list, settings=st) self.assertEqual([neuron], neurons_from_brain_loader)