Skip to content

TST: Test maintenance for test_clique.py - #8214

Merged
dschult merged 4 commits into
networkx:mainfrom
Peiffap:tst/clique
Jul 2, 2026
Merged

dschult merged 4 commits into
networkx:mainfrom
Peiffap:tst/clique

Conversation

@Peiffap

@Peiffap Peiffap commented Aug 30, 2025

Copy link
Copy Markdown
Member

This PR follows up on #8211.

Note to reviewers: rather annoyingly, the diff got messed up because of indentation changes getting rid of the classes. Reviewing commit-by-commit might make things easier to follow. The following functions are unchanged (except for indentation because they are no longer part of a class and use of fixtures instead of setup-based class attributes): test_make_clique_bipartite, test_make_max_clique_graph, test_make_max_clique_graph_create_using, test_enumerate_all_cliques.

The changes can be summarized as follows:

  • Instead of using a setup method, this PR uses pytest fixtures instead. One of those fixtures is the find_clique_fn which is either nx.find_cliques or nx.find_cliques_recursive. This allows us to get rid of about half the assert statements.
  • Splits the tests for node_clique_number and number_of_cliques into two separate (parametrized) test functions, one for the default args, and one for the nodes arg.

@MridulS MridulS added this to the 3.6 milestone Aug 31, 2025
@MridulS MridulS modified the milestones: 3.6, 3.7 Nov 24, 2025

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @Peiffap !

@dschult dschult left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Peiffap !! This looks good to me!

@dschult
dschult merged commit 474f73f into networkx:main Jul 2, 2026
@Peiffap
Peiffap deleted the tst/clique branch July 2, 2026 18:21
toastmt pushed a commit to toastmt/networkx that referenced this pull request Jul 2, 2026
* Parametrize `find_cliques` tests

* Get rid of `setup` method, use fixtures instead

* Parametrize `node_clique_number` and `number_of_cliques` tests

* Parametrize on graph type in directed graph tests, rename trivial -> null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants