From fa6a9e97b5b3c9e9c83b4a843cf186a1cef4c6f6 Mon Sep 17 00:00:00 2001 From: Ankur-Kataria Date: Tue, 1 Sep 2026 20:01:19 +0530 Subject: [PATCH 1/2] fix(sorts): add testmod() call to gnome_sort __main__ block Fixes #14881 - gnome_sort.py did not call testmod() in its __main__ block, unlike other sort implementations (insertion_sort, shell_sort, etc.). Running the file directly with python3 gnome_sort.py would skip doctest verification. Now consistent with the rest of the sorts/ directory. --- sorts/gnome_sort.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sorts/gnome_sort.py b/sorts/gnome_sort.py index ea96e0a926a3..b3f3f53adbf8 100644 --- a/sorts/gnome_sort.py +++ b/sorts/gnome_sort.py @@ -51,6 +51,10 @@ def gnome_sort(lst: list) -> list: if __name__ == "__main__": + from doctest import testmod + + testmod() + user_input = input("Enter numbers separated by a comma:\n").strip() unsorted = [int(item) for item in user_input.split(",")] print(gnome_sort(unsorted)) From ffcf17d0a77ad788b1be884c840b2c5a0689d284 Mon Sep 17 00:00:00 2001 From: Ankur-Kataria Date: Tue, 1 Sep 2026 20:02:23 +0530 Subject: [PATCH 2/2] fix(sorts): add testmod() call to gnome_sort __main__ block --- .oss-upstream | 1 + 1 file changed, 1 insertion(+) create mode 100644 .oss-upstream diff --git a/.oss-upstream b/.oss-upstream new file mode 100644 index 000000000000..4e7045cd6082 --- /dev/null +++ b/.oss-upstream @@ -0,0 +1 @@ +TheAlgorithms/Python