Skip to content

Commit

Permalink
add one more test
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-hwoo committed Jul 30, 2024
1 parent 2e339f4 commit d6d8b23
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,27 @@ def test_base64_encoding_with_different_formats(image_format):
img_bytes = BytesIO(img_data)
image = Image.open(img_bytes)
assert image.format == image_format.name


def test_random_image_format():
random.seed(123)
img1 = SyntheticImageGenerator.create_synthetic_image(
image_width_mean=100,
image_width_stddev=100,
image_height_mean=100,
image_height_stddev=100,
image_format=None,
)

random.seed(456)
img2 = SyntheticImageGenerator.create_synthetic_image(
image_width_mean=100,
image_width_stddev=100,
image_height_mean=100,
image_height_stddev=100,
image_format=None,
)

# check prefix
assert img1.startswith("data:image/png")
assert img2.startswith("data:image/jpeg")

0 comments on commit d6d8b23

Please sign in to comment.