|
27 | 27 |
|
28 | 28 | class DescribeImage(object): |
29 | 29 |
|
| 30 | + def it_can_construct_from_an_image_blob(self, from_blob_fixture): |
| 31 | + blob_, BytesIO_, _from_stream_, stream_, image_ = from_blob_fixture |
| 32 | + image = Image.from_blob(blob_) |
| 33 | + BytesIO_.assert_called_once_with(blob_) |
| 34 | + _from_stream_.assert_called_once_with(stream_, blob_) |
| 35 | + assert image is image_ |
| 36 | + |
30 | 37 | def it_can_construct_from_an_image_path(self, from_path_fixture): |
31 | 38 | image_path, _from_stream_, stream_, blob, filename, image_ = ( |
32 | 39 | from_path_fixture |
@@ -115,6 +122,11 @@ def dpi_fixture(self, image_header_): |
115 | 122 | def filename_(self, request): |
116 | 123 | return instance_mock(request, str) |
117 | 124 |
|
| 125 | + @pytest.fixture |
| 126 | + def from_blob_fixture( |
| 127 | + self, blob_, BytesIO_, _from_stream_, stream_, image_): |
| 128 | + return blob_, BytesIO_, _from_stream_, stream_, image_ |
| 129 | + |
118 | 130 | @pytest.fixture |
119 | 131 | def from_filelike_fixture(self, _from_stream_, image_): |
120 | 132 | image_path = test_file('python-icon.png') |
|
0 commit comments