Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ jobs:
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --with test
#----------------------------------------------
# install your root project, if required
Expand Down
6 changes: 4 additions & 2 deletions equals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import numbers # noqa

from equals.equals import Equals as instance_of # noqa
from equals.constraints.anything_true import AnythingTrue # noqa
from equals.constraints.anything_false import AnythingFalse # noqa
from equals.constraints.anything_true import AnythingTrue # noqa
from equals.equals import Equals as instance_of # noqa

try:
from collections.abc import Iterable # noqa
Expand All @@ -18,6 +18,8 @@
any_string = instance_of(basestring)
except NameError:
any_string = instance_of(str)

any_bytes = instance_of(bytes)
any_number = instance_of(numbers.Number)
any_int = instance_of(int)
any_float = instance_of(float)
Expand Down
26 changes: 26 additions & 0 deletions test/bytes_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from equals import any_bytes


def test_b_string():
assert any_bytes == b"123 abc 456"


def test_containing():
assert any_bytes.containing(b"123") == b"123 abc 456"


def test_endswith():
assert any_bytes.ending_with(b"456") == b"123 abc 456"


def test_string():
assert any_bytes != "123 abc 456"


def test_bytes_string():
assert any_bytes == bytes("123 abc 456", encoding="utf-8")


def test_bytearray():
# Not Sure what wwe want here
assert any_bytes != bytearray("123 abc 456", encoding="utf-8")