@mock.patch.object(dataflow, 'reach_def_analysis')
    def testDefUseGCD(self, mock_reach_def):
        n1 = self._CreateMockNode('n1', 0, [(['a'], 'c'), (['b'], 'd')])
        n2 = self._CreateMockNode('n2', 2, [(['c'], None)])
        n3 = self._CreateMockNode('n3', 3, [(['d'], 'ret')])
        n4 = self._CreateMockNode('n4', 4, [(['d'], None)])
        n5 = self._CreateMockNode('n5', 5, [(['c', 'd'], None)])
        n6 = self._CreateMockNode('n6', 6, [(['c', 'd'], 'c')])
        n7 = self._CreateMockNode('n7', 7, [(['c', 'd'], 'd')])
        n8 = self._CreateMockNode('n8', 8, [(['c'], 'ret')])
        n9 = self._CreateMockNode('n9', 9, [(['ret'], None)])

        graph_mock = mock.create_autospec(graph.Graph)
        graph_mock.rpo = [n1, n2, n3, n4, n5, n6, n7, n8, n9]

        mock_analysis = mock_reach_def.return_value
        mock_analysis.def_to_loc = {
            'a': set([-1]),
            'b': set([-2]),
            'c': set([0, 6]),
            'd': set([1, 7]),
            'ret': set([3, 8])
        }
        mock_analysis.defs = {
            n1: {'c': set([0]),
                 'd': set([1])},
            n2: {},
            n3: {'ret': set([3])},
            n4: {},
            n5: {},
            n6: {'c': set([6])},
            n7: {'d': set([7])},
            n8: {'ret': set([8])},
            n9: {}
        }
        mock_analysis.R = {
            n1: set([-2, -1]),
            n2: set([-2, -1, 0, 1]),
            n3: set([-2, -1, 0, 1]),
            n4: set([-2, -1, 0, 1]),
            n5: set([-2, -1, 0, 1]),
            n6: set([-2, -1, 0, 1]),
            n7: set([-2, -1, 0, 1]),
            n8: set([-2, -1, 0, 1, 6, 7]),
            n9: set([-2, -1, 0, 1, 3, 6, 7, 8])
        }
        expected_du = {
            ('a', -1): [0],
            ('b', -2): [1],
            ('c', 0): [2, 5, 6, 7, 8],
            ('c', 6): [8],
            ('d', 1): [3, 4, 5, 6, 7],
            ('ret', 3): [9],
            ('ret', 8): [9]
        }
        expected_ud = {
            ('a', 0): [-1],
            ('b', 1): [-2],
            ('c', 2): [0],
            ('c', 5): [0],
            ('c', 6): [0],
            ('c', 7): [0],
            ('c', 8): [0, 6],
            ('d', 3): [1],
            ('d', 4): [1],
            ('d', 5): [1],
            ('d', 6): [1],
            ('d', 7): [1],
            ('ret', 9): [3, 8]
        }
        ud, du = dataflow.build_def_use(graph_mock, mock.sentinel)
        self.assertItemsEqual(du, expected_du)
        for entry in du:
            self.assertItemsEqual(du[entry], expected_du[entry])
        self.assertItemsEqual(ud, expected_ud)
        for entry in ud:
            self.assertItemsEqual(ud[entry], expected_ud[entry])
Test that importing a module twice in an try
dataset/ETHPy150Open androguard/androguard/androguard/decompiler/dad/tests/dataflow_test.py/DataflowTest.testDefUseGCD--crossover with--dataset/ETHPy150Open kevinw/pyflakes/pyflakes/test/test_imports.py/Test.test_redefinedTryExcept