Skip to content

Commit 8489d59

Browse files
committed
Remove duplicate tests
1 parent 9eb7f58 commit 8489d59

1 file changed

Lines changed: 0 additions & 57 deletions

File tree

tests/test_add_target.py

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,60 +3,21 @@
33
"""
44

55
import io
6-
import random
76

87
import pytest
98
from mock_vws import MockVWS, States
10-
from PIL import Image
119
from requests import codes
1210

1311
from vws import VWS
1412
from vws.exceptions import (
1513
BadImage,
1614
Fail,
17-
ImageTooLarge,
1815
MetadataTooLarge,
1916
ProjectInactive,
2017
TargetNameExist,
2118
)
2219

2320

24-
def make_image_file(
25-
file_format: str,
26-
color_space: str,
27-
width: int,
28-
height: int,
29-
) -> io.BytesIO:
30-
"""
31-
Return an image file in the given format and color space.
32-
33-
The image file is filled with randomly colored pixels.
34-
35-
Args:
36-
file_format: See
37-
http://pillow.readthedocs.io/en/3.1.x/handbook/image-file-formats.html
38-
color_space: One of "L", "RGB", or "CMYK". "L" means greyscale.
39-
width: The width, in pixels of the image.
40-
height: The width, in pixels of the image.
41-
42-
Returns:
43-
An image file in the given format and color space.
44-
"""
45-
image_buffer = io.BytesIO()
46-
image = Image.new(color_space, (width, height))
47-
pixels = image.load()
48-
for i in range(height):
49-
for j in range(width):
50-
red = random.randint(0, 255)
51-
green = random.randint(0, 255)
52-
blue = random.randint(0, 255)
53-
if color_space != 'L':
54-
pixels[j, i] = (red, green, blue)
55-
image.save(image_buffer, file_format)
56-
image_buffer.seek(0)
57-
return image_buffer
58-
59-
6021
class TestSuccess:
6122
"""
6223
Tests for successfully adding a target.
@@ -117,7 +78,6 @@ def test_add_two_targets_same_name(
11778
assert exc.value.response.status_code == codes.FORBIDDEN
11879

11980

120-
12181
class TestAuthentication:
12282
"""
12383
Tests for authentication issues.
@@ -160,23 +120,6 @@ def test_not_an_image(self, client: VWS) -> None:
160120
with pytest.raises(BadImage):
161121
client.add_target(name='x', width=1, image=not_an_image)
162122

163-
def test_image_too_large(self, client: VWS) -> None:
164-
"""
165-
An ``ImageTooLarge`` exception is raised when the given image is too
166-
large.
167-
"""
168-
width = height = 890
169-
170-
png_too_large = make_image_file(
171-
file_format='PNG',
172-
color_space='RGB',
173-
width=width,
174-
height=height,
175-
)
176-
177-
with pytest.raises(ImageTooLarge):
178-
client.add_target(name='x', width=1, image=png_too_large)
179-
180123

181124
class TestCustomBaseURL:
182125
"""

0 commit comments

Comments
 (0)