Вот ошибки:
/usr/bin/python3 /Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py --path /Users/aleksandrvoytsev/PycharmProjects/hw4-threading-multiprocessing-Kyronison/mandelbrot/test_public.py
Testing started at 19:29 ...
Launching pytest with arguments /Users/aleksandrvoytsev/PycharmProjects/hw4-threading-multiprocessing-Kyronison/mandelbrot/test_public.py --no-header --no-summary -q in /Users/aleksandrvoytsev/PycharmProjects/hw4-threading-multiprocessing-Kyronison/mandelbrot
============================= test session starts ==============================
collecting ... collected 7 items
test_public.py::test_mandelbrot_tiny_image FAILED [ 14%]
test_public.py:10 (test_mandelbrot_tiny_image)
generator = <mandelbrot.MandelbrotGenerator object at 0x11239e970>
def test_mandelbrot_tiny_image(generator: MandelbrotGenerator):
# Test with a tiny 3x3 image
width, height, max_iter = 3, 3, 50
expected_output = np.array([
[1, 3, 9],
[1, 6, 0],
[1, 6, 0]
])
result_original = generator.generate(width, height, max_iter)
result = np.array(result_original)
assert np.array_equal(result, expected_output), f"Tiny image test failed"
E AssertionError: Tiny image test failed
E assert False
E + where False = <function array_equal at 0x10569f930>(array([[1, 1, 1],\n [3, 6, 6],\n [9, 0, 0]]), array([[1, 3, 9],\n [1, 6, 0],\n [1, 6, 0]]))
E + where <function array_equal at 0x10569f930> = np.array_equal
test_public.py:21: AssertionError
test_public.py::test_mandelbrot_single_pixel PASSED [ 28%]
test_public.py::test_mandelbrot_target_images[size0-10]
test_public.py::test_mandelbrot_target_images[size1-50]
test_public.py::test_mandelbrot_target_images[size2-100]
test_public.py::test_mandelbrot_edge_cases FAILED [ 42%]
test_public.py:31 (test_mandelbrot_target_images[size0-10])
np.float64(50.13978478639106) != 0.01
Expected :0.01
Actual :np.float64(50.13978478639106)
generator = <mandelbrot.MandelbrotGenerator object at 0x112204070>
size = (100, 100), max_iter = 10
@pytest.mark.timeout(200)
@pytest.mark.limit_memory("1 GB")
@pytest.mark.parametrize("size,max_iter", [
((100, 100), 10),
((2000, 2000), 50),
((5000, 5000), 100)
])
def test_mandelbrot_target_images(generator: MandelbrotGenerator, size, max_iter):
width, height = size
result = generator.generate(width, height, max_iter)
# Generate the image
temp_file = f"temp_{width}x{height}_{max_iter}.png"
visualize(result, save_path=temp_file)
# Load the generated image and the target image
generated_img = Image.open(temp_file)
target_img = Image.open(f"target_images/{width}x{height}_{max_iter}_mandelbrot.png")
# Compare the images
diff = np.array(generated_img) - np.array(target_img)
mse = np.mean(diff ** 2)
# Clean up the temporary file
os.remove(temp_file)
# Assert that the mean squared error is below a threshold
assert mse < 0.01, f"Generated image differs significantly from target for size {size} and max_iter {max_iter}, MSE: {mse}"
E AssertionError: Generated image differs significantly from target for size (100, 100) and max_iter 10, MSE: 50.13978478639106
E assert np.float64(50.13978478639106) < 0.01
test_public.py:59: AssertionError
FAILED [ 57%]
test_public.py:31 (test_mandelbrot_target_images[size1-50])
np.float64(52.66315213283114) != 0.01
Expected :0.01
Actual :np.float64(52.66315213283114)
generator = <mandelbrot.MandelbrotGenerator object at 0x111f50b50>
size = (2000, 2000), max_iter = 50
@pytest.mark.timeout(200)
@pytest.mark.limit_memory("1 GB")
@pytest.mark.parametrize("size,max_iter", [
((100, 100), 10),
((2000, 2000), 50),
((5000, 5000), 100)
])
def test_mandelbrot_target_images(generator: MandelbrotGenerator, size, max_iter):
width, height = size
result = generator.generate(width, height, max_iter)
# Generate the image
temp_file = f"temp_{width}x{height}_{max_iter}.png"
visualize(result, save_path=temp_file)
# Load the generated image and the target image
generated_img = Image.open(temp_file)
target_img = Image.open(f"target_images/{width}x{height}_{max_iter}_mandelbrot.png")
# Compare the images
diff = np.array(generated_img) - np.array(target_img)
mse = np.mean(diff ** 2)
# Clean up the temporary file
os.remove(temp_file)
# Assert that the mean squared error is below a threshold
assert mse < 0.01, f"Generated image differs significantly from target for size {size} and max_iter {max_iter}, MSE: {mse}"
E AssertionError: Generated image differs significantly from target for size (2000, 2000) and max_iter 50, MSE: 52.66315213283114
E assert np.float64(52.66315213283114) < 0.01
test_public.py:59: AssertionError
FAILED [ 71%]
test_public.py:31 (test_mandelbrot_target_images[size2-100])
np.float64(32.593084915742416) != 0.01
Expected :0.01
Actual :np.float64(32.593084915742416)
generator = <mandelbrot.MandelbrotGenerator object at 0x1119eefd0>
size = (5000, 5000), max_iter = 100
@pytest.mark.timeout(200)
@pytest.mark.limit_memory("1 GB")
@pytest.mark.parametrize("size,max_iter", [
((100, 100), 10),
((2000, 2000), 50),
((5000, 5000), 100)
])
def test_mandelbrot_target_images(generator: MandelbrotGenerator, size, max_iter):
width, height = size
result = generator.generate(width, height, max_iter)
# Generate the image
temp_file = f"temp_{width}x{height}_{max_iter}.png"
visualize(result, save_path=temp_file)
# Load the generated image and the target image
generated_img = Image.open(temp_file)
target_img = Image.open(f"target_images/{width}x{height}_{max_iter}_mandelbrot.png")
# Compare the images
diff = np.array(generated_img) - np.array(target_img)
mse = np.mean(diff ** 2)
# Clean up the temporary file
os.remove(temp_file)
# Assert that the mean squared error is below a threshold
assert mse < 0.01, f"Generated image differs significantly from target for size {size} and max_iter {max_iter}, MSE: {mse}"
E AssertionError: Generated image differs significantly from target for size (5000, 5000) and max_iter 100, MSE: 32.593084915742416
E assert np.float64(32.593084915742416) < 0.01
test_public.py:59: AssertionError
PASSED [ 85%]
test_public.py::test_mandelbrot_consistency PASSED [100%]
============== 4 failed, 3 passed, 2 warnings in 74.02s (0:01:14) ==============
Process finished with exit code 1
Исправь их