def test_load1(self): """ Put the appropriate triples in. Try to load them """ g = R.Graph() self.config['rdf.graph'] = g for t in self.trips: g.add(t) c = Connection(conf=self.config) for x in c.load(): self.assertIsInstance(x, Connection)
def test_load_with_filter(self): # Put the appropriate triples in. Try to load them g = R.Graph() self.config['rdf.graph'] = g for t in self.trips: g.add(t) c = Connection(pre_cell="PVCR", conf=self.config) r = c.load() for x in r: self.assertIsInstance(x, Connection)
def test_init_with_neuron_objects(self): n1 = Neuron(name="AVAL") n2 = Neuron(name="PVCR") try: Connection(n1, n2) except Exception: self.fail("Shouldn't fail on Connection init")
def test_adal_connections(): """ See github issue openworm/PyOpenWorm#90 """ for x in range(10): adal = Neuron("ADAL") post = Neuron() Connection(pre_cell=adal, post_cell=post) tuple(post.load())
def test_init(self): """Initialization with positional parameters""" c = Connection('AVAL', 'ADAR', 3, 'send', 'Serotonin') self.assertIsInstance(c.pre_cell(), Neuron) self.assertIsInstance(c.post_cell(), Neuron) self.assertEqual(c.number(), 3) self.assertEqual(c.syntype(), 'send') self.assertEqual(c.synclass(), 'Serotonin')
def test_init_number_is_a_number(self): with self.assertRaises(Exception): Connection(1, 2, "gazillion", 4, 5)
def test_connection_count(self): n = self.neur('AVAL') n.connection(Connection(n, self.neur('PVCL'), syntype='send')) n.save() self.assertEqual(1, self.neur('AVAL').connection.count())