Code Duplication    Length = 24-24 lines in 2 locations

tests/graphinate/renderers/test_matplotlib_plot.py 2 locations

@@ 242-265 (lines=24) @@
239
240
241
# Plot a graph with custom edge attributes that aren't 'label'
242
def test_plot_with_custom_edge_attributes(mocker):
243
    # Arrange
244
    mock_draw = mocker.patch('graphinate.renderers.matplotlib.draw')
245
    mock_pyplot = mocker.patch('graphinate.renderers.matplotlib.pyplot')
246
    mock_ax = mocker.MagicMock()
247
    mock_fig = mocker.MagicMock()
248
    mock_pyplot.gca.return_value = mock_ax
249
    mock_pyplot.gcf.return_value = mock_fig
250
251
    graph = nx.Graph(name="Graph with Custom Edge Attributes")
252
    graph.add_node(1, label="Node 1")
253
    graph.add_node(2, label="Node 2")
254
    graph.add_edge(1, 2, label="Edge 1-2", weight=5, type="connection")
255
256
    # Act
257
    from graphinate.renderers.matplotlib import plot
258
    plot(graph, with_edge_labels=True)
259
260
    # Assert
261
    mock_draw.assert_called_once_with(graph, True, True)
262
    mock_ax.margins.assert_called_once_with(0.10)
263
    mock_fig.suptitle.assert_called_once_with("Graph with Custom Edge Attributes")
264
    mock_fig.tight_layout.assert_called_once()
265
    mock_pyplot.show.assert_called_once()
266
@@ 215-238 (lines=24) @@
212
213
214
# Plot a graph with custom node attributes that aren't 'label'
215
def test_plot_with_custom_node_attributes(mocker):
216
    # Arrange
217
    mock_draw = mocker.patch('graphinate.renderers.matplotlib.draw')
218
    mock_pyplot = mocker.patch('graphinate.renderers.matplotlib.pyplot')
219
    mock_ax = mocker.MagicMock()
220
    mock_fig = mocker.MagicMock()
221
    mock_pyplot.gca.return_value = mock_ax
222
    mock_pyplot.gcf.return_value = mock_fig
223
224
    graph = nx.Graph(name="Graph with Custom Node Attributes")
225
    graph.add_node(1, label="Node 1", weight=10, category="A")
226
    graph.add_node(2, label="Node 2", weight=5, category="B")
227
    graph.add_edge(1, 2)
228
229
    # Act
230
    from graphinate.renderers.matplotlib import plot
231
    plot(graph)
232
233
    # Assert
234
    mock_draw.assert_called_once_with(graph, True, False)
235
    mock_ax.margins.assert_called_once_with(0.10)
236
    mock_fig.suptitle.assert_called_once_with("Graph with Custom Node Attributes")
237
    mock_fig.tight_layout.assert_called_once()
238
    mock_pyplot.show.assert_called_once()
239
240
241
# Plot a graph with custom edge attributes that aren't 'label'