Beispiel #1
0
    def test_compnents_appear_more_than_twice(self):
        net_to_comp = {
            'Net1': ['CxRB_320', 'CxRB_320', 'CxRB_320', 'R2'],
            'Net2': ['CxRB_320', 'CxRB_320', 'CxRB_320'],
        }
        comp_to_net = CurrentFlow.swap_key_to_value(net_to_comp)
        self.assertEqual(
            sorted(
                CurrentFlow.find_all_flows('Net1', net_to_comp, comp_to_net)),
            ['Net1', 'Net2', ]
        )

        self.assertEqual(
            sorted(
                CurrentFlow.find_all_flows('Net2', net_to_comp, comp_to_net)),
            ['Net1', 'Net2', ]
        )
Beispiel #2
0
 def test_find_all_flows_case1(self):
     net_to_comp = {
         'Net1': ['R1', 'R2'],
         'Net2': ['R1'],
         'Net3': ['R2']
     }
     comp_to_net = CurrentFlow.swap_key_to_value(net_to_comp)
     self.assertEqual(
         sorted(
             CurrentFlow.find_all_flows('Net1', net_to_comp, comp_to_net)),
         ['Net1', 'Net2', 'Net3']
     )
     self.assertEqual(
         sorted(
             CurrentFlow.find_all_flows('Net2', net_to_comp, comp_to_net)),
         ['Net1', 'Net2', 'Net3']
     )
     self.assertEqual(
         sorted(
             CurrentFlow.find_all_flows('Net3', net_to_comp, comp_to_net)),
         ['Net1', 'Net2', 'Net3']
     )
Beispiel #3
0
 def test_find_all_flows_case2(self):
     net_to_comp = {
         'Net1': ['R1', 'R2'],
         'Net2': ['R1'],
         'Net3': ['R3'],
         'Net4': ['R2', 'R3', 'R4'],
         'Net5': ['R4', 'R5', 'R6', 'R7', 'R8'],
         'Net6': ['R5'],
         'Net7': ['R6']
     }
     comp_to_net = CurrentFlow.swap_key_to_value(net_to_comp)
     self.assertEqual(
         sorted(
             CurrentFlow.find_all_flows('Net1', net_to_comp, comp_to_net)),
         ['Net1', 'Net2', 'Net3', 'Net4', 'Net5', 'Net6', 'Net7']
     )
     self.assertEqual(
         sorted(
             CurrentFlow.find_all_flows('Net2', net_to_comp, comp_to_net)),
         ['Net1', 'Net2', 'Net3', 'Net4', 'Net5', 'Net6', 'Net7']
     )
     self.assertEqual(
         sorted(
             CurrentFlow.find_all_flows('Net3', net_to_comp, comp_to_net)),
         ['Net1', 'Net2', 'Net3', 'Net4', 'Net5', 'Net6', 'Net7']
     )
     self.assertEqual(
         sorted(
             CurrentFlow.find_all_flows('Net4', net_to_comp, comp_to_net)),
         ['Net1', 'Net2', 'Net3', 'Net4', 'Net5', 'Net6', 'Net7']
     )
     self.assertEqual(
         sorted(
             CurrentFlow.find_all_flows('Net5', net_to_comp, comp_to_net)),
         ['Net1', 'Net2', 'Net3', 'Net4', 'Net5', 'Net6', 'Net7']
     )
     self.assertEqual(
         sorted(
             CurrentFlow.find_all_flows('Net6', net_to_comp, comp_to_net)),
         ['Net1', 'Net2', 'Net3', 'Net4', 'Net5', 'Net6', 'Net7']
     )
     self.assertEqual(
         sorted(
             CurrentFlow.find_all_flows('Net7', net_to_comp, comp_to_net)),
         ['Net1', 'Net2', 'Net3', 'Net4', 'Net5', 'Net6', 'Net7']
     )