Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
akash-akya committed Dec 21, 2024
1 parent 1a7a4f2 commit aa75387
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 185 deletions.
7 changes: 4 additions & 3 deletions lib/vix/vips/image.ex
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,8 @@ defmodule Vix.Vips.Image do
with {:ok, blank_pixel} <- Operation.black(1, 1, bands: length(background)),
{:ok, pixel} <- Operation.linear(blank_pixel, [1.0], background),
{:ok, pixel} <- Operation.cast(pixel, opts[:format]),
{:ok, img} <- Operation.embed(pixel, 0, 0, width, height, extend: :VIPS_EXTEND_COPY),
{:ok, img} <- Operation.copy(img, interpretation: opts[:interpretation]) do
{:ok, img}
{:ok, img} <- Operation.embed(pixel, 0, 0, width, height, extend: :VIPS_EXTEND_COPY) do
Operation.copy(img, interpretation: opts[:interpretation])
end
end

Expand Down Expand Up @@ -1523,6 +1522,7 @@ defmodule Vix.Vips.Image do
end

@spec guess_format([number]) :: Vix.Vips.Operation.vips_band_format()
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
defp guess_format(background) do
types = Enum.map(background, &guess_num_type/1)

Expand Down Expand Up @@ -1568,6 +1568,7 @@ defmodule Vix.Vips.Image do
end

@spec type_to_vips_band_format(allowed_types) :: Vix.Vips.Operation.vips_band_format()
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
defp type_to_vips_band_format(type) do
case type do
{:u, 8} ->
Expand Down
182 changes: 0 additions & 182 deletions test/vix/operator_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -201,186 +201,4 @@ defmodule Vix.OperatorTest do
assert 3 ** 2 == 9
end
end

describe "</2" do
test "when both arguments are image" do
img = Image.build_image!(10, 10, [4])
refute img < img

img2 = Image.build_image!(10, 10, [5])

assert result = img < img2
assert is_boolean(result)

assert img < Image.build_image!(10, 10, [9.0])
end

test "when first argument is image and second argument is list" do
img = Image.build_image!(10, 10, [4])
assert img < [5]
refute img < [0]
end

test "when first argument is a list and second argument is image" do
img = Image.build_image!(10, 10, [4])
assert [0] < img
refute [5] < img
end

test "when both arguments are numbers" do
assert 2 < 3
end
end

describe "<=/2" do
test "when both arguments are image" do
img = Image.build_image!(10, 10, [4])
assert img <= img

img2 = Image.build_image!(10, 10, [5])

assert result = img <= img2
assert is_boolean(result)

assert img <= Image.build_image!(10, 10, [9.0])
end

test "when first argument is image and second argument is list" do
img = Image.build_image!(10, 10, [4])
assert img <= [5]
refute img <= [0]
end

test "when first argument is a list and second argument is image" do
img = Image.build_image!(10, 10, [4])
assert [0] <= img
refute [5] <= img
end

test "when both arguments are numbers" do
assert 2 <= 3
end
end

describe ">/2" do
test "when both arguments are image" do
img = Image.build_image!(10, 10, [4])
refute img > img

img2 = Image.build_image!(10, 10, [3])

assert result = img > img2
assert is_boolean(result)

assert img > Image.build_image!(10, 10, [2.0])
end

test "when first argument is image and second argument is list" do
img = Image.build_image!(10, 10, [4])
assert img > [0]
refute img > [5]
end

test "when first argument is a list and second argument is image" do
img = Image.build_image!(10, 10, [4])
assert [5] > img
refute [0] > img
end

test "when both arguments are numbers" do
assert 3 > 2
end
end

describe ">=/2" do
test "when both arguments are image" do
img = Image.build_image!(10, 10, [4])
assert img >= img

img2 = Image.build_image!(10, 10, [3])

assert result = img >= img2
assert is_boolean(result)

assert img >= Image.build_image!(10, 10, [2.0])
end

test "when first argument is image and second argument is list" do
img = Image.build_image!(10, 10, [4])
assert img >= [0]
refute img >= [5]
end

test "when first argument is a list and second argument is image" do
img = Image.build_image!(10, 10, [4])
assert [5] >= img
refute [0] >= img
end

test "when both arguments are numbers" do
assert 3 >= 2
end
end

describe "==/2" do
test "when both arguments are image" do
img = Image.build_image!(10, 10, [4])
assert img == img

img2 = Image.build_image!(10, 10, [5])

refute result = img == img2
assert is_boolean(result)

assert img == Image.build_image!(10, 10, [4.0])
end

test "when first argument is image and second argument is list" do
img = Image.build_image!(10, 10, [4])
assert img == [4]
refute img == [0]
end

test "when first argument is a list and second argument is image" do
img = Image.build_image!(10, 10, [4])
refute [0] == img
assert [4] == img
end

test "when both arguments are numbers" do
assert 3 == 3
refute 2 == 3
end
end

describe "!=/2" do
test "when both arguments are image" do
img = Image.build_image!(10, 10, [4])
refute img != img

img2 = Image.build_image!(10, 10, [5])

assert result = img != img2
assert is_boolean(result)

refute img != Image.build_image!(10, 10, [4.0])
end

test "when first argument is image and second argument is list" do
img = Image.build_image!(10, 10, [4])
refute img != [4]
assert img != [0]
end

test "when first argument is a list and second argument is image" do
img = Image.build_image!(10, 10, [4])
assert [0] != img
refute [4] != img
end

test "when both arguments are numbers" do
refute 3 != 3
assert 2 != 3
end
end
end

0 comments on commit aa75387

Please sign in to comment.