bitmask.py: rewrite unit tests to new format

This commit is contained in:
dogeystamp 2022-08-02 21:57:24 -04:00
parent a90d767595
commit 6ccad93aa2
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38

View File

@ -22,49 +22,45 @@ class Colors(IntFlag):
def test_eq(): def test_eq():
"""Test equality checks.""" """Test equality checks."""
# Equality # Equality
assert Bitmask(Desc) == Bitmask(Desc) assert Bitmask() == Bitmask()
assert Bitmask(Desc, Desc.SMALL) == Bitmask(Desc, Desc.SMALL) assert Bitmask(Desc.SMALL) == Bitmask(Desc.SMALL)
assert Bitmask(Desc, Desc.SMALL, Desc.ROUND) == Bitmask( assert Bitmask(Desc.SMALL, Desc.ROUND) == Bitmask(Desc, Desc.SMALL, Desc.ROUND)
Desc, Desc.SMALL, Desc.ROUND assert Bitmask(Desc.ROUND, Desc.SMALL) == Bitmask(Desc, Desc.SMALL, Desc.ROUND)
)
assert Bitmask(Desc, Desc.ROUND, Desc.SMALL) == Bitmask(
Desc, Desc.SMALL, Desc.ROUND
)
# Inequality # Inequality
assert Bitmask(Desc, Desc.SMALL) != Bitmask(Desc, Desc.SMALL, Desc.ROUND) assert Bitmask(Desc.SMALL) != Bitmask(Desc.SMALL, Desc.ROUND)
assert Bitmask(Desc, Desc.SMALL) != Bitmask(Desc, Desc.ROUND) assert Bitmask(Desc.SMALL) != Bitmask(Desc.ROUND)
assert Bitmask(Desc, Desc.SMALL) != Bitmask(Desc) assert Bitmask(Desc.SMALL) != Bitmask()
assert Bitmask(Desc, Desc.SMALL) != Desc.SMALL assert Bitmask(Desc.SMALL) != Desc.SMALL
assert Bitmask(Desc, Desc.SMALL) != Desc.ROUND assert Bitmask(Desc.SMALL) != Desc.ROUND
assert Bitmask(Desc) != Desc.ROUND assert Bitmask() != Desc.ROUND
# Wrong types # Wrong types
assert Bitmask(Desc) != "Hello World!" assert Bitmask() != "Hello World!"
assert Bitmask(Desc) != 0 assert Bitmask() != 0
assert Bitmask(Desc) != Bitmask(Colors) assert Bitmask() != Bitmask(Colors)
def test_repr(): def test_repr():
"""Ensure evaluating __repr__ creates an identical object.""" """Ensure evaluating __repr__ creates an identical object."""
mask = Bitmask(Desc, Desc.ROUND, Desc.FUNKY) mask = Bitmask(Desc.ROUND, Desc.FUNKY)
assert eval(repr(mask)) == mask assert eval(repr(mask)) == mask
empty_mask = Bitmask(Desc) empty_mask = Bitmask()
assert eval(repr(empty_mask)) == empty_mask assert eval(repr(empty_mask)) == empty_mask
def test_add(): def test_add():
"""Test Bitmask.add() method.""" """Test Bitmask.add() method."""
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
mask.add(Desc.ROUND) mask.add(Desc.ROUND)
assert mask == Bitmask(Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND) assert mask == Bitmask(Desc.SMALL, Desc.FUNKY, Desc.ROUND)
mask = Bitmask(Desc) mask = Bitmask()
mask.add(Desc.ROUND) mask.add(Desc.ROUND)
assert mask == Bitmask(Desc, Desc.ROUND) assert mask == Bitmask(Desc.ROUND)
mask.add(Desc.ROUND) mask.add(Desc.ROUND)
assert mask == Bitmask(Desc, Desc.ROUND) assert mask == Bitmask(Desc.ROUND)
with pytest.raises(TypeError, match=".* Desc .* Bitmask.*"): with pytest.raises(TypeError, match=".* Desc .* Bitmask.*"):
mask.add(1) mask.add(1)
@ -75,209 +71,205 @@ def test_add():
def test_add_operator(): def test_add_operator():
"""Test + operator.""" """Test + operator."""
# Individual flags # Individual flags
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
assert mask + Desc.ROUND == Bitmask(Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND) assert mask + Desc.ROUND == Bitmask(Desc.SMALL, Desc.FUNKY, Desc.ROUND)
assert Desc.ROUND + mask == Bitmask(Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND) assert Desc.ROUND + mask == Bitmask(Desc.SMALL, Desc.FUNKY, Desc.ROUND)
assert Desc.SMALL + mask == Bitmask(Desc, Desc.SMALL, Desc.FUNKY) assert Desc.SMALL + mask == Bitmask(Desc.SMALL, Desc.FUNKY)
assert Bitmask(Desc) + Desc.ROUND == Bitmask(Desc, Desc.ROUND) assert Bitmask() + Desc.ROUND == Bitmask(Desc.ROUND)
# Union of bitmasks # Union of bitmasks
assert Bitmask(Desc, Desc.SMALL) + Bitmask(Desc, Desc.FUNKY, Desc.ROUND) == Bitmask( assert Bitmask(Desc.SMALL) + Bitmask(Desc.FUNKY, Desc.ROUND) == Bitmask(
Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND
) )
assert Bitmask(Desc, Desc.FUNKY, Desc.ROUND) + Bitmask(Desc, Desc.SMALL) == Bitmask( assert Bitmask(Desc.FUNKY, Desc.ROUND) + Bitmask(Desc.SMALL) == Bitmask(
Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND
) )
assert Bitmask(Desc) + Bitmask(Desc) == Bitmask(Desc) assert Bitmask() + Bitmask() == Bitmask()
def test_add_inline(): def test_add_inline():
"""Test += operator.""" """Test += operator."""
# Individual flags # Individual flags
mask = Bitmask(Desc) mask = Bitmask()
mask += Desc.FUNKY mask += Desc.FUNKY
assert mask == Bitmask(Desc, Desc.FUNKY) assert mask == Bitmask(Desc.FUNKY)
mask += Desc.ROUND mask += Desc.ROUND
assert mask == Bitmask(Desc, Desc.FUNKY, Desc.ROUND) assert mask == Bitmask(Desc.FUNKY, Desc.ROUND)
# Bitmasks # Bitmasks
mask = Bitmask(Desc) mask = Bitmask()
mask += Bitmask(Desc, Desc.ROUND, Desc.FUNKY) mask += Bitmask(Desc.ROUND, Desc.FUNKY)
assert mask == Bitmask(Desc, Desc.FUNKY, Desc.ROUND) assert mask == Bitmask(Desc.FUNKY, Desc.ROUND)
def test_or_operator(): def test_or_operator():
"""Test | operator.""" """Test | operator."""
# Individual flags # Individual flags
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
assert mask | Desc.ROUND == Bitmask(Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND) assert mask | Desc.ROUND == Bitmask(Desc.SMALL, Desc.FUNKY, Desc.ROUND)
assert Desc.ROUND | mask == Bitmask(Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND) assert Desc.ROUND | mask == Bitmask(Desc.SMALL, Desc.FUNKY, Desc.ROUND)
assert Desc.SMALL | mask == Bitmask(Desc, Desc.SMALL, Desc.FUNKY) assert Desc.SMALL | mask == Bitmask(Desc.SMALL, Desc.FUNKY)
assert Bitmask(Desc) | Desc.ROUND == Bitmask(Desc, Desc.ROUND) assert Bitmask() | Desc.ROUND == Bitmask(Desc.ROUND)
# Union of bitmasks # Union of bitmasks
assert Bitmask(Desc, Desc.SMALL) | Bitmask(Desc, Desc.FUNKY, Desc.ROUND) == Bitmask( assert Bitmask(Desc.SMALL) | Bitmask(Desc.FUNKY, Desc.ROUND) == Bitmask(
Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND
) )
assert Bitmask(Desc, Desc.FUNKY, Desc.ROUND) | Bitmask(Desc, Desc.SMALL) == Bitmask( assert Bitmask(Desc.FUNKY, Desc.ROUND) | Bitmask(Desc.SMALL) == Bitmask(
Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND
) )
assert Bitmask(Desc) | Bitmask(Desc) == Bitmask(Desc) assert Bitmask() | Bitmask() == Bitmask()
def test_or_inline(): def test_or_inline():
"""Test |= operator.""" """Test |= operator."""
# Individual flags # Individual flags
mask = Bitmask(Desc) mask = Bitmask()
mask |= Desc.FUNKY mask |= Desc.FUNKY
assert mask == Bitmask(Desc, Desc.FUNKY) assert mask == Bitmask(Desc.FUNKY)
mask |= Desc.ROUND mask |= Desc.ROUND
assert mask == Bitmask(Desc, Desc.FUNKY, Desc.ROUND) assert mask == Bitmask(Desc.FUNKY, Desc.ROUND)
# Bitmasks # Bitmasks
mask = Bitmask(Desc) mask = Bitmask()
mask |= Bitmask(Desc, Desc.ROUND, Desc.FUNKY) mask |= Bitmask(Desc.ROUND, Desc.FUNKY)
assert mask == Bitmask(Desc, Desc.FUNKY, Desc.ROUND) assert mask == Bitmask(Desc.FUNKY, Desc.ROUND)
def test_and_operator(): def test_and_operator():
"""Test & operator.""" """Test & operator."""
# Individual flags # Individual flags
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
assert mask & Desc.SMALL == Bitmask(Desc, Desc.SMALL) assert mask & Desc.SMALL == Bitmask(Desc.SMALL)
assert Desc.SMALL & mask == Bitmask(Desc, Desc.SMALL) assert Desc.SMALL & mask == Bitmask(Desc.SMALL)
assert Desc.ROUND & mask == Bitmask(Desc) assert Desc.ROUND & mask == Bitmask()
assert Bitmask(Desc) & Desc.ROUND == Bitmask(Desc) assert Bitmask() & Desc.ROUND == Bitmask()
# AND of bitmasks # AND of bitmasks
assert Bitmask(Desc, Desc.FUNKY, Desc.SONAR) & Bitmask( assert Bitmask(Desc.FUNKY, Desc.SONAR) & Bitmask(
Desc, Desc.FUNKY, Desc.ROUND Desc, Desc.FUNKY, Desc.ROUND
) == Bitmask(Desc, Desc.FUNKY) ) == Bitmask(Desc.FUNKY)
assert Bitmask(Desc, Desc.FUNKY, Desc.ROUND) & Bitmask(Desc, Desc.SMALL) == Bitmask( assert Bitmask(Desc.FUNKY, Desc.ROUND) & Bitmask(Desc.SMALL) == Bitmask(Desc)
Desc assert Bitmask() & Bitmask() == Bitmask()
)
assert Bitmask(Desc) & Bitmask(Desc) == Bitmask(Desc)
def test_and_inline(): def test_and_inline():
"""Test &= operator.""" """Test &= operator."""
# Individual flags # Individual flags
mask = Bitmask(Desc, Desc.FUNKY, Desc.SMALL) mask = Bitmask(Desc.FUNKY, Desc.SMALL)
mask &= Desc.FUNKY mask &= Desc.FUNKY
assert mask == Bitmask(Desc, Desc.FUNKY) assert mask == Bitmask(Desc.FUNKY)
mask &= Desc.ROUND mask &= Desc.ROUND
assert mask == Bitmask(Desc) assert mask == Bitmask()
# Bitmasks # Bitmasks
mask = Bitmask(Desc, Desc.ROUND, Desc.FUNKY) mask = Bitmask(Desc.ROUND, Desc.FUNKY)
mask &= Bitmask(Desc, Desc.SMALL) mask &= Bitmask(Desc.SMALL)
assert mask == Bitmask(Desc) assert mask == Bitmask()
def test_remove(): def test_remove():
"""Test the `Bitmask.remove()` method.""" """Test the `Bitmask.remove()` method."""
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
mask.remove(Desc.SMALL) mask.remove(Desc.SMALL)
assert mask == Bitmask(Desc, Desc.FUNKY) assert mask == Bitmask(Desc.FUNKY)
with pytest.raises(KeyError): with pytest.raises(KeyError):
mask.remove(Desc.SMALL) mask.remove(Desc.SMALL)
empty_mask = Bitmask(Desc) empty_mask = Bitmask()
with pytest.raises(KeyError): with pytest.raises(KeyError):
empty_mask.remove(Desc.SMALL) empty_mask.remove(Desc.SMALL)
def test_discard(): def test_discard():
"""Test the `Bitmask.discard()` method.""" """Test the `Bitmask.discard()` method."""
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
mask.discard(Desc.SMALL) mask.discard(Desc.SMALL)
assert mask == Bitmask(Desc, Desc.FUNKY) assert mask == Bitmask(Desc.FUNKY)
mask.discard(Desc.SMALL) mask.discard(Desc.SMALL)
assert mask == Bitmask(Desc, Desc.FUNKY) assert mask == Bitmask(Desc.FUNKY)
empty_mask = Bitmask(Desc) empty_mask = Bitmask()
empty_mask.discard(Desc.SMALL) empty_mask.discard(Desc.SMALL)
assert empty_mask == Bitmask(Desc) assert empty_mask == Bitmask()
with pytest.raises(TypeError, match="can only discard Desc from Bitmask"): with pytest.raises(TypeError, match="can only discard Desc from Bitmask"):
empty_mask.discard(Bitmask(Desc, Desc.SMALL)) empty_mask.discard(Bitmask(Desc.SMALL))
def test_subtract(): def test_subtract():
"""Test - operator.""" """Test - operator."""
# Individual flag # Individual flag
assert Bitmask(Desc, Desc.SMALL, Desc.FUNKY) - Desc.SMALL == Bitmask( assert Bitmask(Desc.SMALL, Desc.FUNKY) - Desc.SMALL == Bitmask(Desc, Desc.FUNKY)
Desc, Desc.FUNKY assert Bitmask(Desc.FUNKY, Desc.SMALL) - Desc.SMALL == Bitmask(Desc, Desc.FUNKY)
)
assert Bitmask(Desc, Desc.FUNKY, Desc.SMALL) - Desc.SMALL == Bitmask(
Desc, Desc.FUNKY
)
# Two bitmasks # Two bitmasks
assert Bitmask(Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND) - Bitmask( assert Bitmask(Desc.SMALL, Desc.FUNKY, Desc.ROUND) - Bitmask(
Desc, Desc.SMALL, Desc.ROUND Desc, Desc.SMALL, Desc.ROUND
) == Bitmask(Desc, Desc.FUNKY) ) == Bitmask(Desc.FUNKY)
assert Bitmask(Desc, Desc.FUNKY, Desc.SMALL) - Bitmask( assert (
Desc, Desc.SMALL, Desc.FUNKY Bitmask(Desc.FUNKY, Desc.SMALL) - Bitmask(Desc, Desc.SMALL, Desc.FUNKY)
) == Bitmask(Desc) == Bitmask()
)
def test_subtract_inline(): def test_subtract_inline():
"""Test -= operator.""" """Test -= operator."""
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
mask -= Desc.SMALL mask -= Desc.SMALL
assert mask == Bitmask(Desc, Desc.FUNKY) assert mask == Bitmask(Desc.FUNKY)
def test_xor_operator(): def test_xor_operator():
"""Test ^ operator.""" """Test ^ operator."""
# Individual flags # Individual flags
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
assert mask ^ Desc.ROUND == Bitmask(Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND) assert mask ^ Desc.ROUND == Bitmask(Desc.SMALL, Desc.FUNKY, Desc.ROUND)
assert Desc.ROUND ^ mask == Bitmask(Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND) assert Desc.ROUND ^ mask == Bitmask(Desc.SMALL, Desc.FUNKY, Desc.ROUND)
assert Desc.SMALL ^ mask == Bitmask(Desc, Desc.FUNKY) assert Desc.SMALL ^ mask == Bitmask(Desc.FUNKY)
assert Bitmask(Desc) ^ Desc.ROUND == Bitmask(Desc, Desc.ROUND) assert Bitmask() ^ Desc.ROUND == Bitmask(Desc.ROUND)
# XOR bitmasks # XOR bitmasks
assert Bitmask(Desc, Desc.SMALL) ^ Bitmask(Desc, Desc.FUNKY, Desc.ROUND) == Bitmask( assert Bitmask(Desc.SMALL) ^ Bitmask(Desc.FUNKY, Desc.ROUND) == Bitmask(
Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND
) )
assert Bitmask(Desc, Desc.FUNKY, Desc.ROUND) ^ Bitmask( assert (
Desc, Desc.FUNKY, Desc.ROUND Bitmask(Desc.FUNKY, Desc.ROUND) ^ Bitmask(Desc, Desc.FUNKY, Desc.ROUND)
) == Bitmask(Desc) == Bitmask()
assert Bitmask(Desc) ^ Bitmask(Desc) == Bitmask(Desc) )
assert Bitmask() ^ Bitmask() == Bitmask()
def test_xor_inline(): def test_xor_inline():
"""Test ^= operator.""" """Test ^= operator."""
# Individual flags # Individual flags
mask = Bitmask(Desc) mask = Bitmask()
mask ^= Desc.FUNKY mask ^= Desc.FUNKY
assert mask == Bitmask(Desc, Desc.FUNKY) assert mask == Bitmask(Desc.FUNKY)
mask ^= Desc.ROUND mask ^= Desc.ROUND
assert mask == Bitmask(Desc, Desc.FUNKY, Desc.ROUND) assert mask == Bitmask(Desc.FUNKY, Desc.ROUND)
mask ^= Desc.ROUND mask ^= Desc.ROUND
assert mask == Bitmask(Desc, Desc.FUNKY) assert mask == Bitmask(Desc.FUNKY)
# Bitmasks # Bitmasks
mask = Bitmask(Desc, Desc.ROUND) mask = Bitmask(Desc.ROUND)
mask ^= Bitmask(Desc, Desc.ROUND, Desc.FUNKY) mask ^= Bitmask(Desc.ROUND, Desc.FUNKY)
assert mask == Bitmask(Desc, Desc.FUNKY) assert mask == Bitmask(Desc.FUNKY)
def test_value(): def test_value():
"""Ensure Bitmask.value lines up with the state.""" """Ensure Bitmask.value lines up with the state."""
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
assert mask.value == 5 assert mask.value == 5
mask.add(Desc.ROUND) mask.add(Desc.ROUND)
assert mask.value == 7 assert mask.value == 7
assert Bitmask(Desc).value == 0 assert Bitmask().value == 0
# Setting values directly # Setting values directly
mask.value = 0 mask.value = 0
assert mask == Bitmask(Desc) assert mask == Bitmask()
mask.value = 1 mask.value = 1
assert mask == Bitmask(Desc, Desc.SMALL) assert mask == Bitmask(Desc.SMALL)
with pytest.raises(TypeError, match="value must be an integer"): with pytest.raises(TypeError, match="value must be an integer"):
mask.value = 1j mask.value = 1j
with pytest.raises(TypeError, match="value must be an integer"): with pytest.raises(TypeError, match="value must be an integer"):
@ -286,8 +278,8 @@ def test_value():
def test_contains(): def test_contains():
"""Test `flag in mask` check.""" """Test `flag in mask` check."""
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
empty_mask = Bitmask(Desc) empty_mask = Bitmask()
# Individual flags # Individual flags
assert Desc.FUNKY in mask assert Desc.FUNKY in mask
@ -297,16 +289,16 @@ def test_contains():
# Bitmasks # Bitmasks
assert mask in mask assert mask in mask
assert Bitmask(Desc, Desc.SMALL, Desc.FUNKY) in mask assert Bitmask(Desc.SMALL, Desc.FUNKY) in mask
assert Bitmask(Desc, Desc.SMALL, Desc.FUNKY, Desc.ROUND) not in mask assert Bitmask(Desc.SMALL, Desc.FUNKY, Desc.ROUND) not in mask
assert Bitmask(Desc, Desc.FUNKY) in mask assert Bitmask(Desc.FUNKY) in mask
with pytest.raises(TypeError, match="item must be Bitmask or Desc"): with pytest.raises(TypeError, match="item must be Bitmask or Desc"):
assert 1 in mask assert 1 in mask
def test_iter(): def test_iter():
"""Test iteration.""" """Test iteration."""
assert [i for i in Bitmask(Desc, Desc.SMALL, Desc.FUNKY)] == [ assert [i for i in Bitmask(Desc.SMALL, Desc.FUNKY)] == [
Desc.SMALL, Desc.SMALL,
Desc.FUNKY, Desc.FUNKY,
] ]
@ -314,18 +306,18 @@ def test_iter():
def test_str(): def test_str():
"""Test string conversion.""" """Test string conversion."""
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
assert str(mask) == "SMALL|FUNKY" assert str(mask) == "SMALL|FUNKY"
mask.add(Desc.ROUND) mask.add(Desc.ROUND)
assert str(mask) == "SMALL|ROUND|FUNKY" assert str(mask) == "SMALL|ROUND|FUNKY"
assert str(Bitmask(Desc, Desc.ROUND)) == "ROUND" assert str(Bitmask(Desc.ROUND)) == "ROUND"
assert str(Bitmask(Desc)) == "0" assert str(Bitmask()) == "0"
def test_int(): def test_int():
"""Test int conversion.""" """Test int conversion."""
mask = Bitmask(Desc, Desc.SMALL, Desc.FUNKY) mask = Bitmask(Desc.SMALL, Desc.FUNKY)
assert int(mask) == mask.value assert int(mask) == mask.value
mask.value = 4 mask.value = 4
assert int(mask) == mask.value assert int(mask) == mask.value
@ -333,6 +325,6 @@ def test_int():
def test_hex(): def test_hex():
"""Test hexadecimal conversion.""" """Test hexadecimal conversion."""
assert hex(Bitmask(Desc, Desc.SMALL)) == "0x1" assert hex(Bitmask(Desc.SMALL)) == "0x1"
assert hex(Bitmask(Desc)) == "0x0" assert hex(Bitmask()) == "0x0"
assert hex(Bitmask(Desc, Desc.SONAR)) == "0x10" assert hex(Bitmask(Desc.SONAR)) == "0x10"