def test_cm_params3(net):
    cm = ConnectionMap(sources=net.nodes(ei='i'),
                       targets=net.nodes(ei='e'),
                       connector=lambda s, t: 3,
                       edge_type_properties={
                           'prop1': 'prop1',
                           'node_type_id': 101
                       })
    cm.add_properties(names=['w', 'c'], rule=0.15, dtypes=[float, str])
    cm.add_properties(names='a', rule=(1, 2, 3), dtypes=dict)

    assert (len(cm.params) == 2)
    edge_props_1 = cm.params[0]
    assert (edge_props_1.names == ['w', 'c'])
    assert (edge_props_1.get_prop_dtype('w'))
    assert (edge_props_1.get_prop_dtype('c'))
    for v in cm.connection_itr():
        src_id, trg_id, nsyn = v
        assert (nsyn == 3)
        assert (edge_props_1.rule() == 0.15)

    edge_props_2 = cm.params[1]
    assert (edge_props_2.names == 'a')
    assert (edge_props_2.get_prop_dtype('a'))
    assert (edge_props_2.rule() == (1, 2, 3))
def test_cm_params1(net):
    cm = ConnectionMap(sources=net.nodes(ei='i'),
                       targets=net.nodes(ei='e'),
                       connector=lambda s, t: 3,
                       edge_type_properties={
                           'prop1': 'prop1',
                           'node_type_id': 101
                       })
    cm.add_properties(names='syn_weight',
                      rule=lambda a: a + 0.15,
                      rule_params={'a': 0.20},
                      dtypes=float)

    assert (len(cm.params) == 1)
    edge_props_1 = cm.params[0]
    assert (edge_props_1.names == 'syn_weight')
    assert (edge_props_1.get_prop_dtype('syn_weight') == float)
    for v in cm.connection_itr():
        src_id, trg_id, nsyn = v
        assert (nsyn == 3)
        assert (edge_props_1.rule() == 0.35)