def test_construct_dependency_graph_cycle(self, context: Context) -> None: """Test constructing dependency graph information with cycles.""" context = flexmock(dependencies=self._DEPENDENCIES_CYCLE) dependency_graph = Product._construct_dependency_graph(context, self._DEPENDENCIES_CYCLE_PIPFILE_LOCK) assert dependency_graph["nodes"] == ["a", "b", "c"] assert set(tuple(i) for i in dependency_graph["edges"]) == {(0, 1), (2, 0), (2, 1)}
def test_construct_dependency_graph_basic(self) -> None: """Test constructing dependency graph.""" context = flexmock(dependencies=self._DEPENDENCIES_NO_CYCLE) dependency_graph = Product._construct_dependency_graph(context, self._DEPENDENCIES_NO_CYCLE_PIPFILE_LOCK) assert dependency_graph["nodes"] == ["absl-py", "astor", "six", "tensorflow"] assert set(tuple(i) for i in dependency_graph["edges"]) == {(0, 2), (1, 2), (3, 1), (3, 0)}