mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 23:11:09 +00:00
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>
This commit is contained in:
parent
218d8921db
commit
bd9464e4ac
|
@ -317,6 +317,7 @@
|
||||||
* [Breadth First Search Shortest Path](https://github.com/TheAlgorithms/Python/blob/master/graphs/breadth_first_search_shortest_path.py)
|
* [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 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 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)
|
* [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](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)
|
* [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)
|
* [Md5](https://github.com/TheAlgorithms/Python/blob/master/hashes/md5.py)
|
||||||
* [Sdbm](https://github.com/TheAlgorithms/Python/blob/master/hashes/sdbm.py)
|
* [Sdbm](https://github.com/TheAlgorithms/Python/blob/master/hashes/sdbm.py)
|
||||||
* [Sha1](https://github.com/TheAlgorithms/Python/blob/master/hashes/sha1.py)
|
* [Sha1](https://github.com/TheAlgorithms/Python/blob/master/hashes/sha1.py)
|
||||||
|
* [Sha256](https://github.com/TheAlgorithms/Python/blob/master/hashes/sha256.py)
|
||||||
|
|
||||||
## Knapsack
|
## Knapsack
|
||||||
* [Greedy Knapsack](https://github.com/TheAlgorithms/Python/blob/master/knapsack/greedy_knapsack.py)
|
* [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 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 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)
|
* [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)
|
* [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)
|
* [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)
|
* [Slack Message](https://github.com/TheAlgorithms/Python/blob/master/web_programming/slack_message.py)
|
||||||
|
|
|
@ -101,9 +101,11 @@ def get_image(
|
||||||
of the Mandelbrot set is viewed. The main area of the Mandelbrot set is
|
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.
|
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)
|
(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)
|
(255, 255, 255)
|
||||||
"""
|
"""
|
||||||
img = Image.new("RGB", (image_width, image_height))
|
img = Image.new("RGB", (image_width, image_height))
|
||||||
|
|
|
@ -34,16 +34,19 @@ class Node:
|
||||||
|
|
||||||
class BreadthFirstSearch:
|
class BreadthFirstSearch:
|
||||||
"""
|
"""
|
||||||
>>> bfs = BreadthFirstSearch((0, 0), (len(grid) - 1, len(grid[0]) - 1))
|
# Comment out slow pytests...
|
||||||
>>> (bfs.start.pos_y + delta[3][0], bfs.start.pos_x + delta[3][1])
|
# 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)
|
(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)]
|
[(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)
|
(1, 0)
|
||||||
>>> bfs.retrace_path(bfs.start)
|
# >>> bfs.retrace_path(bfs.start)
|
||||||
[(0, 0)]
|
[(0, 0)]
|
||||||
>>> bfs.search() # doctest: +NORMALIZE_WHITESPACE
|
# >>> bfs.search() # doctest: +NORMALIZE_WHITESPACE
|
||||||
[(0, 0), (1, 0), (2, 0), (3, 0), (3, 1), (4, 1),
|
[(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)]
|
(5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (6, 5), (6, 6)]
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -9,7 +9,8 @@ from .binary_exp_mod import bin_exp_mod
|
||||||
def is_prime(n, prec=1000):
|
def is_prime(n, prec=1000):
|
||||||
"""
|
"""
|
||||||
>>> from .prime_check import prime_check
|
>>> 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
|
True
|
||||||
"""
|
"""
|
||||||
if n < 2:
|
if n < 2:
|
||||||
|
|
|
@ -24,9 +24,10 @@ def download_images_from_google_query(query: str = "dhaka", max_images: int = 5)
|
||||||
Returns:
|
Returns:
|
||||||
The number of images successfully downloaded.
|
The number of images successfully downloaded.
|
||||||
|
|
||||||
>>> download_images_from_google_query()
|
# Comment out slow (4.20s call) doctests
|
||||||
|
# >>> download_images_from_google_query()
|
||||||
5
|
5
|
||||||
>>> download_images_from_google_query("potato")
|
# >>> download_images_from_google_query("potato")
|
||||||
5
|
5
|
||||||
"""
|
"""
|
||||||
max_images = min(max_images, 50) # Prevent abuse!
|
max_images = min(max_images, 50) # Prevent abuse!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user