def test_removes_sinkless_filters(self): """Test that making a netlist correctly filters out passthrough Nodes with no outgoing connections. """ # Create the first operator object_a = mock.Mock(name="object A") vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") operator_a = mock.Mock(name="operator A") operator_a.make_vertices.return_value = \ netlistspec(vertex_a, load_fn_a, pre_fn_a, post_fn_a) # Create the second operator object_b = mock.Mock(name="object B") operator_b = operators.Filter(16) # Shouldn't need building # Create the model, add the items and add an entry to the connection # map. model = Model() model.object_operators[object_a] = operator_a model.object_operators[object_b] = operator_b model.connection_map.add_connection(operator_a, None, SignalParameters(), None, operator_b, None, None) netlist = model.make_netlist(1) # The netlist should contain vertex a and no nets assert netlist.nets == list() assert netlist.vertices == [vertex_a]
def test_calls_add_default_keyspace(self): """Test that creating a netlist assigns from default keyspace to the network. """ # Create a model and patch out the default keyspace and the connection # map. default_ks = mock.Mock() model = Model(keyspaces={"nengo": default_ks}) # Create the netlist, ensure that this results in a call to # `add_default_keyspace' with mock.patch.object(model.connection_map, "add_default_keyspace") as f: model.make_netlist() f.assert_called_once_with(default_ks)
def test_removes_sinkless_filters(self): """Test that making a netlist correctly filters out passthrough Nodes with no outgoing connections. """ # Create the first operator object_a = mock.Mock(name="object A") vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") operator_a = mock.Mock(name="operator A") operator_a.make_vertices.return_value = \ netlistspec(vertex_a, load_fn_a, pre_fn_a, post_fn_a) # Create the second operator object_b = mock.Mock(name="object B") operator_b = operators.Filter(16) # Shouldn't need building # Create the model, add the items and add an entry to the connection # map. model = Model() model.object_operators[object_a] = operator_a model.object_operators[object_b] = operator_b model.connection_map.add_connection( operator_a, None, SignalParameters(), None, operator_b, None, None ) netlist = model.make_netlist(1) # The netlist should contain vertex a and no nets assert netlist.nets == list() assert netlist.vertices == [vertex_a]
def test_calls_add_default_keyspace(self): """Test that creating a netlist assigns from default keyspace to the network. """ # Create a model and patch out the default keyspace and the connection # map. default_ks = mock.Mock() model = Model(keyspaces={"nengo": default_ks}) # Create the netlist, ensure that this results in a call to # `add_default_keyspace' with mock.patch.object(model.connection_map, "add_default_keyspace") as f: model.make_netlist() f.assert_called_once_with(default_ks)
def test_single_vertices(self): """Test that operators which produce single vertices work correctly and that all functions and signals are correctly collected and included in the final netlist. """ # Create the first operator vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") object_a = mock.Mock(name="object A") operator_a = mock.Mock(name="operator A") operator_a.make_vertices.return_value = \ netlistspec(vertex_a, load_fn_a, pre_fn_a, post_fn_a) # Create the second operator vertex_b = mock.Mock(name="vertex B") load_fn_b = mock.Mock(name="load function B") object_b = mock.Mock(name="object B") operator_b = mock.Mock(name="operator B") operator_b.make_vertices.return_value = \ netlistspec(vertex_b, load_fn_b) # Create a signal between the operators keyspace = mock.Mock(name="keyspace") keyspace.length = 32 signal_ab = Signal(ObjectPort(operator_a, None), ObjectPort(operator_b, None), keyspace=keyspace, weight=43) # Create the model, add the items and then generate the netlist model = Model() model.object_operators[object_a] = operator_a model.object_operators[object_b] = operator_b model.connections_signals[None] = signal_ab netlist = model.make_netlist() # Check that the make_vertices functions were called operator_a.make_vertices.assert_called_once_with(model) operator_b.make_vertices.assert_called_once_with(model) # Check that the netlist is as expected assert len(netlist.nets) == 1 for net in netlist.nets: assert net.source is vertex_a assert net.sinks == [vertex_b] assert net.keyspace is keyspace assert net.weight == signal_ab.weight assert set(netlist.vertices) == set([vertex_a, vertex_b]) assert netlist.keyspaces is model.keyspaces assert netlist.groups == list() assert set(netlist.load_functions) == set([load_fn_a, load_fn_b]) assert netlist.before_simulation_functions == [pre_fn_a] assert netlist.after_simulation_functions == [post_fn_a]
def test_extra_operators_and_signals(self): """Test the operators and signals in the extra_operators and extra_signals lists are included when building netlists. """ # Create the first operator vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") operator_a = mock.Mock(name="operator A") operator_a.make_vertices.return_value = \ netlistspec(vertex_a, load_fn_a, pre_fn_a, post_fn_a) # Create the second operator vertex_b = mock.Mock(name="vertex B") load_fn_b = mock.Mock(name="load function B") operator_b = mock.Mock(name="operator B") operator_b.make_vertices.return_value = \ netlistspec(vertex_b, load_fn_b) # Create a signal between the operators keyspace = mock.Mock(name="keyspace") keyspace.length = 32 signal_ab = Signal(ObjectPort(operator_a, None), ObjectPort(operator_b, None), keyspace=keyspace, weight=43) # Create the model, add the items and then generate the netlist model = Model() model.extra_operators = [operator_a, operator_b] model.extra_signals = [signal_ab] netlist = model.make_netlist() # Check that the make_vertices functions were called operator_a.make_vertices.assert_called_once_with(model) operator_b.make_vertices.assert_called_once_with(model) # Check that the netlist is as expected assert len(netlist.nets) == 1 for net in netlist.nets: assert net.source is vertex_a assert net.sinks == [vertex_b] assert net.keyspace is keyspace assert net.weight == signal_ab.weight assert set(netlist.vertices) == set([vertex_a, vertex_b]) assert netlist.keyspaces is model.keyspaces assert netlist.groups == list() assert set(netlist.load_functions) == set([load_fn_a, load_fn_b]) assert netlist.before_simulation_functions == [pre_fn_a] assert netlist.after_simulation_functions == [post_fn_a]
def test_multiple_sink_vertices(self): # Create the first operator vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") object_a = mock.Mock(name="object A") operator_a = mock.Mock(name="operator A") operator_a.make_vertices.return_value = \ netlistspec(vertex_a, load_fn_a, pre_fn_a, post_fn_a) # Create the second operator vertex_b0 = mock.Mock(name="vertex B0") vertex_b1 = mock.Mock(name="vertex B1") load_fn_b = mock.Mock(name="load function B") object_b = mock.Mock(name="object B") operator_b = mock.Mock(name="operator B") operator_b.make_vertices.return_value = \ netlistspec([vertex_b0, vertex_b1], load_fn_b) # Create a signal between the operators keyspace = mock.Mock(name="keyspace") keyspace.length = 32 signal_ab = Signal(ObjectPort(operator_a, None), ObjectPort(operator_b, None), keyspace=keyspace, weight=3) # Create the model, add the items and then generate the netlist model = Model() model.object_operators[object_a] = operator_a model.object_operators[object_b] = operator_b model.connections_signals[None] = signal_ab netlist = model.make_netlist() # Check that the netlist is as expected assert set(netlist.vertices) == set([vertex_a, vertex_b0, vertex_b1]) assert len(netlist.nets) == 1 for net in netlist.nets: assert net.source is vertex_a assert net.sinks == [vertex_b0, vertex_b1] assert net.keyspace is keyspace assert net.weight == signal_ab.weight # Check that the groups are correct assert netlist.groups == [set([vertex_b0, vertex_b1])]
def test_extra_operators_and_signals(self): """Test the operators in the extra_operators list are included when building netlists. """ # Create the first operator vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") operator_a = mock.Mock(name="operator A", spec_set=["make_vertices"]) operator_a.make_vertices.return_value = \ netlistspec((vertex_a, ), load_fn_a, pre_fn_a, post_fn_a) # Create the second operator vertex_b = mock.Mock(name="vertex B") load_fn_b = mock.Mock(name="load function B") operator_b = mock.Mock(name="operator B", spec_set=["make_vertices"]) operator_b.make_vertices.return_value = \ netlistspec((vertex_b, ), load_fn_b) # Create the model, add the items and then generate the netlist model = Model() model.extra_operators = [operator_a, operator_b] netlist = model.make_netlist() # Check that the make_vertices functions were called operator_a.make_vertices.assert_called_once_with(model) operator_b.make_vertices.assert_called_once_with(model) # Check that the netlist is as expected assert len(netlist.nets) == 0 assert netlist.operator_vertices == { operator_a: (vertex_a, ), operator_b: (vertex_b, ), } assert netlist.keyspaces is model.keyspaces assert len(netlist.constraints) == 0 assert set(netlist.load_functions) == set([load_fn_a, load_fn_b]) assert netlist.before_simulation_functions == [pre_fn_a] assert netlist.after_simulation_functions == [post_fn_a]
def test_extra_operators_and_signals(self): """Test the operators in the extra_operators list are included when building netlists. """ # Create the first operator vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") operator_a = mock.Mock(name="operator A", spec_set=["make_vertices"]) operator_a.make_vertices.return_value = \ netlistspec((vertex_a, ), load_fn_a, pre_fn_a, post_fn_a) # Create the second operator vertex_b = mock.Mock(name="vertex B") load_fn_b = mock.Mock(name="load function B") operator_b = mock.Mock(name="operator B", spec_set=["make_vertices"]) operator_b.make_vertices.return_value = \ netlistspec((vertex_b, ), load_fn_b) # Create the model, add the items and then generate the netlist model = Model() model.extra_operators = [operator_a, operator_b] netlist = model.make_netlist() # Check that the make_vertices functions were called operator_a.make_vertices.assert_called_once_with(model) operator_b.make_vertices.assert_called_once_with(model) # Check that the netlist is as expected assert len(netlist.nets) == 0 assert netlist.operator_vertices == { operator_a: (vertex_a, ), operator_b: (vertex_b, ), } assert netlist.keyspaces is model.keyspaces assert len(netlist.constraints) == 0 assert set(netlist.load_functions) == set([load_fn_a, load_fn_b]) assert netlist.before_simulation_functions == [pre_fn_a] assert netlist.after_simulation_functions == [post_fn_a]
def test_multiple_source_vertices(self): """Test that each of the vertices associated with a source is correctly included in the sources of a net. """ class MyVertexSlice(VertexSlice): def __init__(self, *args, **kwargs): super(MyVertexSlice, self).__init__(*args, **kwargs) self.args = None def transmits_signal(self, signal_parameters, transmission_parameters): self.args = (signal_parameters, transmission_parameters) return False # Create the first operator vertex_a0 = VertexSlice(slice(0, 1)) vertex_a1 = VertexSlice(slice(1, 2)) vertex_a2 = MyVertexSlice(slice(2, 3)) load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") object_a = mock.Mock(name="object A") operator_a = mock.Mock(name="operator A", spec_set=["make_vertices"]) operator_a.make_vertices.return_value = \ netlistspec([vertex_a0, vertex_a1, vertex_a2], load_fn_a, pre_fn_a, post_fn_a) # Create the second operator vertex_b = Vertex() load_fn_b = mock.Mock(name="load function B") object_b = mock.Mock(name="object B") operator_b = mock.Mock(name="operator B", spec_set=["make_vertices"]) operator_b.make_vertices.return_value = \ netlistspec((vertex_b, ), load_fn_b) # Create a signal between the operators keyspace = mock.Mock(name="keyspace") keyspace.length = 32 signal_ab_parameters = SignalParameters(keyspace=keyspace, weight=43) # Create the model, add the items and then generate the netlist model = Model() model.object_operators[object_a] = operator_a model.object_operators[object_b] = operator_b model.connection_map.add_connection( operator_a, None, signal_ab_parameters, None, operator_b, None, None ) netlist = model.make_netlist() # Check that the netlist is as expected assert netlist.operator_vertices == { operator_a: (vertex_a0, vertex_a1, vertex_a2), operator_b: (vertex_b, ), } assert len(netlist.nets) == 1 for net in itervalues(netlist.nets): assert net.sources == [vertex_a0, vertex_a1] assert net.sinks == [vertex_b] assert len(netlist.constraints) == 0 # Check that `transmit_signal` was called correctly sig, tp = vertex_a2.args assert sig.keyspace is keyspace assert tp is None
def test_multiple_sink_vertices(self): """Test that each of the vertices associated with a sink is correctly included in the sinks of a net. """ # Create the first operator vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") object_a = mock.Mock(name="object A") operator_a = mock.Mock(name="operator A", spec_set=["make_vertices"]) operator_a.make_vertices.return_value = \ netlistspec((vertex_a, ), load_fn_a, pre_fn_a, post_fn_a) # Create the second operator vertex_b0 = mock.Mock(name="vertex B0") vertex_b1 = mock.Mock(name="vertex B1") load_fn_b = mock.Mock(name="load function B") object_b = mock.Mock(name="object B") operator_b = mock.Mock(name="operator B", spec_set=["make_vertices"]) operator_b.make_vertices.return_value = \ netlistspec([vertex_b0, vertex_b1], load_fn_b) # Create a third operator, which won't accept the signal vertex_c = mock.Mock(name="vertex C") vertex_c.accepts_signal.side_effect = lambda _, __: False object_c = mock.Mock(name="object C") operator_c = mock.Mock(name="operator C", spec_set=["make_vertices"]) operator_c.make_vertices.return_value = netlistspec((vertex_c, )) # Create a signal between the operators keyspace = mock.Mock(name="keyspace") keyspace.length = 32 signal_ab_parameters = SignalParameters(keyspace=keyspace, weight=3) # Create the model, add the items and then generate the netlist model = Model() model.object_operators[object_a] = operator_a model.object_operators[object_b] = operator_b model.object_operators[object_c] = operator_c model.connection_map.add_connection( operator_a, None, signal_ab_parameters, None, operator_b, None, None ) model.connection_map.add_connection( operator_a, None, signal_ab_parameters, None, operator_c, None, None ) netlist = model.make_netlist() # Check that the "accepts_signal" method of vertex_c was called with # reasonable arguments assert vertex_c.accepts_signal.called # Check that the netlist is as expected assert netlist.operator_vertices == { operator_a: (vertex_a, ), operator_b: (vertex_b0, vertex_b1), operator_c: (vertex_c, ), } assert len(netlist.nets) == 1 for net in itervalues(netlist.nets): assert net.sources == [vertex_a] assert net.sinks == [vertex_b0, vertex_b1] assert net.weight == signal_ab_parameters.weight assert len(netlist.constraints) == 0
def test_single_vertices(self): """Test that operators which produce single vertices work correctly and that all functions and signals are correctly collected and included in the final netlist. """ # Create the first operator vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") constraint_a = mock.Mock(name="Constraint B") object_a = mock.Mock(name="object A") operator_a = mock.Mock(name="operator A", spec_set=["make_vertices"]) operator_a.make_vertices.return_value = \ netlistspec((vertex_a, ), load_fn_a, pre_fn_a, post_fn_a, constraint_a) # Create the second operator vertex_b = mock.Mock(name="vertex B") load_fn_b = mock.Mock(name="load function B") constraint_b = mock.Mock(name="Constraint B") object_b = mock.Mock(name="object B") operator_b = mock.Mock(name="operator B", spec_set=["make_vertices"]) operator_b.make_vertices.return_value = \ netlistspec((vertex_b, ), load_fn_b, constraints=[constraint_b]) # Create a signal between the operators keyspace = mock.Mock(name="keyspace") keyspace.length = 32 signal_ab_parameters = SignalParameters(keyspace=keyspace, weight=43) # Create the model, add the items and then generate the netlist model = Model() model.object_operators[object_a] = operator_a model.object_operators[object_b] = operator_b model.connection_map.add_connection( operator_a, None, signal_ab_parameters, None, operator_b, None, None ) netlist = model.make_netlist() # Check that the make_vertices functions were called operator_a.make_vertices.assert_called_once_with(model) operator_b.make_vertices.assert_called_once_with(model) # Check that the netlist is as expected assert len(netlist.nets) == 1 for net in itervalues(netlist.nets): assert net.sources == [vertex_a] assert net.sinks == [vertex_b] assert net.weight == signal_ab_parameters.weight assert netlist.operator_vertices == { operator_a: (vertex_a, ), operator_b: (vertex_b, ), } assert netlist.keyspaces is model.keyspaces assert set(netlist.constraints) == set([constraint_a, constraint_b]) assert set(netlist.load_functions) == set([load_fn_a, load_fn_b]) assert netlist.before_simulation_functions == [pre_fn_a] assert netlist.after_simulation_functions == [post_fn_a]
def test_multiple_source_vertices(self): """Test that each of the vertices associated with a source is correctly included in the sources of a net. """ class MyVertexSlice(VertexSlice): def __init__(self, *args, **kwargs): super(MyVertexSlice, self).__init__(*args, **kwargs) self.args = None def transmits_signal(self, signal_parameters, transmission_parameters): self.args = (signal_parameters, transmission_parameters) return False # Create the first operator vertex_a0 = VertexSlice(slice(0, 1)) vertex_a1 = VertexSlice(slice(1, 2)) vertex_a2 = MyVertexSlice(slice(2, 3)) load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") object_a = mock.Mock(name="object A") operator_a = mock.Mock(name="operator A", spec_set=["make_vertices"]) operator_a.make_vertices.return_value = \ netlistspec([vertex_a0, vertex_a1, vertex_a2], load_fn_a, pre_fn_a, post_fn_a) # Create the second operator vertex_b = Vertex() load_fn_b = mock.Mock(name="load function B") object_b = mock.Mock(name="object B") operator_b = mock.Mock(name="operator B", spec_set=["make_vertices"]) operator_b.make_vertices.return_value = \ netlistspec((vertex_b, ), load_fn_b) # Create a signal between the operators keyspace = mock.Mock(name="keyspace") keyspace.length = 32 signal_ab_parameters = SignalParameters(keyspace=keyspace, weight=43) # Create the model, add the items and then generate the netlist model = Model() model.object_operators[object_a] = operator_a model.object_operators[object_b] = operator_b model.connection_map.add_connection(operator_a, None, signal_ab_parameters, None, operator_b, None, None) netlist = model.make_netlist() # Check that the netlist is as expected assert netlist.operator_vertices == { operator_a: (vertex_a0, vertex_a1, vertex_a2), operator_b: (vertex_b, ), } assert len(netlist.nets) == 1 for net in itervalues(netlist.nets): assert net.sources == [vertex_a0, vertex_a1] assert net.sinks == [vertex_b] assert len(netlist.constraints) == 0 # Check that `transmit_signal` was called correctly sig, tp = vertex_a2.args assert sig.keyspace is keyspace assert tp is None
def test_multiple_sink_vertices(self): """Test that each of the vertices associated with a sink is correctly included in the sinks of a net. """ # Create the first operator vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") object_a = mock.Mock(name="object A") operator_a = mock.Mock(name="operator A", spec_set=["make_vertices"]) operator_a.make_vertices.return_value = \ netlistspec((vertex_a, ), load_fn_a, pre_fn_a, post_fn_a) # Create the second operator vertex_b0 = mock.Mock(name="vertex B0") vertex_b1 = mock.Mock(name="vertex B1") load_fn_b = mock.Mock(name="load function B") object_b = mock.Mock(name="object B") operator_b = mock.Mock(name="operator B", spec_set=["make_vertices"]) operator_b.make_vertices.return_value = \ netlistspec([vertex_b0, vertex_b1], load_fn_b) # Create a third operator, which won't accept the signal vertex_c = mock.Mock(name="vertex C") vertex_c.accepts_signal.side_effect = lambda _, __: False object_c = mock.Mock(name="object C") operator_c = mock.Mock(name="operator C", spec_set=["make_vertices"]) operator_c.make_vertices.return_value = netlistspec((vertex_c, )) # Create a signal between the operators keyspace = mock.Mock(name="keyspace") keyspace.length = 32 signal_ab_parameters = SignalParameters(keyspace=keyspace, weight=3) # Create the model, add the items and then generate the netlist model = Model() model.object_operators[object_a] = operator_a model.object_operators[object_b] = operator_b model.object_operators[object_c] = operator_c model.connection_map.add_connection(operator_a, None, signal_ab_parameters, None, operator_b, None, None) model.connection_map.add_connection(operator_a, None, signal_ab_parameters, None, operator_c, None, None) netlist = model.make_netlist() # Check that the "accepts_signal" method of vertex_c was called with # reasonable arguments assert vertex_c.accepts_signal.called # Check that the netlist is as expected assert netlist.operator_vertices == { operator_a: (vertex_a, ), operator_b: (vertex_b0, vertex_b1), operator_c: (vertex_c, ), } assert len(netlist.nets) == 1 for net in itervalues(netlist.nets): assert net.sources == [vertex_a] assert net.sinks == [vertex_b0, vertex_b1] assert net.weight == signal_ab_parameters.weight assert len(netlist.constraints) == 0
def test_single_vertices(self): """Test that operators which produce single vertices work correctly and that all functions and signals are correctly collected and included in the final netlist. """ # Create the first operator vertex_a = mock.Mock(name="vertex A") load_fn_a = mock.Mock(name="load function A") pre_fn_a = mock.Mock(name="pre function A") post_fn_a = mock.Mock(name="post function A") constraint_a = mock.Mock(name="Constraint B") object_a = mock.Mock(name="object A") operator_a = mock.Mock(name="operator A", spec_set=["make_vertices"]) operator_a.make_vertices.return_value = \ netlistspec((vertex_a, ), load_fn_a, pre_fn_a, post_fn_a, constraint_a) # Create the second operator vertex_b = mock.Mock(name="vertex B") load_fn_b = mock.Mock(name="load function B") constraint_b = mock.Mock(name="Constraint B") object_b = mock.Mock(name="object B") operator_b = mock.Mock(name="operator B", spec_set=["make_vertices"]) operator_b.make_vertices.return_value = \ netlistspec((vertex_b, ), load_fn_b, constraints=[constraint_b]) # Create a signal between the operators keyspace = mock.Mock(name="keyspace") keyspace.length = 32 signal_ab_parameters = SignalParameters(keyspace=keyspace, weight=43) # Create the model, add the items and then generate the netlist model = Model() model.object_operators[object_a] = operator_a model.object_operators[object_b] = operator_b model.connection_map.add_connection(operator_a, None, signal_ab_parameters, None, operator_b, None, None) netlist = model.make_netlist() # Check that the make_vertices functions were called operator_a.make_vertices.assert_called_once_with(model) operator_b.make_vertices.assert_called_once_with(model) # Check that the netlist is as expected assert len(netlist.nets) == 1 for net in itervalues(netlist.nets): assert net.sources == [vertex_a] assert net.sinks == [vertex_b] assert net.weight == signal_ab_parameters.weight assert netlist.operator_vertices == { operator_a: (vertex_a, ), operator_b: (vertex_b, ), } assert netlist.keyspaces is model.keyspaces assert set(netlist.constraints) == set([constraint_a, constraint_b]) assert set(netlist.load_functions) == set([load_fn_a, load_fn_b]) assert netlist.before_simulation_functions == [pre_fn_a] assert netlist.after_simulation_functions == [post_fn_a]