From bd9464e4ac6ccccd4699bf52bddefa2bfb1dafea Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 23 Oct 2021 18:15:30 +0200 Subject: [PATCH] mandelbrot.py: Commenting out long running tests (#5558) * mandelbrot.py: Commenting out long running tests * updating DIRECTORY.md * Comment out 9 sec doctests * Update bidirectional_breadth_first_search.py * Comment out slow tests * Comment out slow (9.15 sec) pytests... * # Comment out slow (4.20s call) doctests * Comment out slow (3.45s) doctests * Update miller_rabin.py * Update miller_rabin.py Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> --- DIRECTORY.md | 3 +++ fractals/mandelbrot.py | 6 ++++-- graphs/bidirectional_breadth_first_search.py | 15 +++++++++------ maths/miller_rabin.py | 3 ++- .../download_images_from_google_query.py | 5 +++-- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/DIRECTORY.md b/DIRECTORY.md index 950d8e2c0..66d5f8040 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -317,6 +317,7 @@ * [Breadth First Search Shortest Path](https://github.com/TheAlgorithms/Python/blob/master/graphs/breadth_first_search_shortest_path.py) * [Check Bipartite Graph Bfs](https://github.com/TheAlgorithms/Python/blob/master/graphs/check_bipartite_graph_bfs.py) * [Check Bipartite Graph Dfs](https://github.com/TheAlgorithms/Python/blob/master/graphs/check_bipartite_graph_dfs.py) + * [Check Cycle](https://github.com/TheAlgorithms/Python/blob/master/graphs/check_cycle.py) * [Connected Components](https://github.com/TheAlgorithms/Python/blob/master/graphs/connected_components.py) * [Depth First Search](https://github.com/TheAlgorithms/Python/blob/master/graphs/depth_first_search.py) * [Depth First Search 2](https://github.com/TheAlgorithms/Python/blob/master/graphs/depth_first_search_2.py) @@ -370,6 +371,7 @@ * [Md5](https://github.com/TheAlgorithms/Python/blob/master/hashes/md5.py) * [Sdbm](https://github.com/TheAlgorithms/Python/blob/master/hashes/sdbm.py) * [Sha1](https://github.com/TheAlgorithms/Python/blob/master/hashes/sha1.py) + * [Sha256](https://github.com/TheAlgorithms/Python/blob/master/hashes/sha256.py) ## Knapsack * [Greedy Knapsack](https://github.com/TheAlgorithms/Python/blob/master/knapsack/greedy_knapsack.py) @@ -979,6 +981,7 @@ * [Instagram Crawler](https://github.com/TheAlgorithms/Python/blob/master/web_programming/instagram_crawler.py) * [Instagram Pic](https://github.com/TheAlgorithms/Python/blob/master/web_programming/instagram_pic.py) * [Instagram Video](https://github.com/TheAlgorithms/Python/blob/master/web_programming/instagram_video.py) + * [Nasa Data](https://github.com/TheAlgorithms/Python/blob/master/web_programming/nasa_data.py) * [Random Anime Character](https://github.com/TheAlgorithms/Python/blob/master/web_programming/random_anime_character.py) * [Recaptcha Verification](https://github.com/TheAlgorithms/Python/blob/master/web_programming/recaptcha_verification.py) * [Slack Message](https://github.com/TheAlgorithms/Python/blob/master/web_programming/slack_message.py) diff --git a/fractals/mandelbrot.py b/fractals/mandelbrot.py index de795bb3f..5d61b72e1 100644 --- a/fractals/mandelbrot.py +++ b/fractals/mandelbrot.py @@ -101,9 +101,11 @@ def get_image( of the Mandelbrot set is viewed. The main area of the Mandelbrot set is roughly between "-1.5 < x < 0.5" and "-1 < y < 1" in the figure-coordinates. - >>> get_image().load()[0,0] + Commenting out tests that slow down pytest... + # 13.35s call fractals/mandelbrot.py::mandelbrot.get_image + # >>> get_image().load()[0,0] (255, 0, 0) - >>> get_image(use_distance_color_coding = False).load()[0,0] + # >>> get_image(use_distance_color_coding = False).load()[0,0] (255, 255, 255) """ img = Image.new("RGB", (image_width, image_height)) diff --git a/graphs/bidirectional_breadth_first_search.py b/graphs/bidirectional_breadth_first_search.py index 27e4f0b16..511b080a9 100644 --- a/graphs/bidirectional_breadth_first_search.py +++ b/graphs/bidirectional_breadth_first_search.py @@ -34,16 +34,19 @@ class Node: class BreadthFirstSearch: """ - >>> bfs = BreadthFirstSearch((0, 0), (len(grid) - 1, len(grid[0]) - 1)) - >>> (bfs.start.pos_y + delta[3][0], bfs.start.pos_x + delta[3][1]) + # Comment out slow pytests... + # 9.15s call graphs/bidirectional_breadth_first_search.py:: \ + # graphs.bidirectional_breadth_first_search.BreadthFirstSearch + # >>> bfs = BreadthFirstSearch((0, 0), (len(grid) - 1, len(grid[0]) - 1)) + # >>> (bfs.start.pos_y + delta[3][0], bfs.start.pos_x + delta[3][1]) (0, 1) - >>> [x.pos for x in bfs.get_successors(bfs.start)] + # >>> [x.pos for x in bfs.get_successors(bfs.start)] [(1, 0), (0, 1)] - >>> (bfs.start.pos_y + delta[2][0], bfs.start.pos_x + delta[2][1]) + # >>> (bfs.start.pos_y + delta[2][0], bfs.start.pos_x + delta[2][1]) (1, 0) - >>> bfs.retrace_path(bfs.start) + # >>> bfs.retrace_path(bfs.start) [(0, 0)] - >>> bfs.search() # doctest: +NORMALIZE_WHITESPACE + # >>> bfs.search() # doctest: +NORMALIZE_WHITESPACE [(0, 0), (1, 0), (2, 0), (3, 0), (3, 1), (4, 1), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (6, 5), (6, 6)] """ diff --git a/maths/miller_rabin.py b/maths/miller_rabin.py index fe9920271..2b0944508 100644 --- a/maths/miller_rabin.py +++ b/maths/miller_rabin.py @@ -9,7 +9,8 @@ from .binary_exp_mod import bin_exp_mod def is_prime(n, prec=1000): """ >>> from .prime_check import prime_check - >>> all(is_prime(i) == prime_check(i) for i in range(1000)) + >>> # all(is_prime(i) == prime_check(i) for i in range(1000)) # 3.45s + >>> all(is_prime(i) == prime_check(i) for i in range(256)) True """ if n < 2: diff --git a/web_programming/download_images_from_google_query.py b/web_programming/download_images_from_google_query.py index c26262788..b11a7f883 100644 --- a/web_programming/download_images_from_google_query.py +++ b/web_programming/download_images_from_google_query.py @@ -24,9 +24,10 @@ def download_images_from_google_query(query: str = "dhaka", max_images: int = 5) Returns: The number of images successfully downloaded. - >>> download_images_from_google_query() + # Comment out slow (4.20s call) doctests + # >>> download_images_from_google_query() 5 - >>> download_images_from_google_query("potato") + # >>> download_images_from_google_query("potato") 5 """ max_images = min(max_images, 50) # Prevent abuse!