-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38e8905
commit 681cef8
Showing
27 changed files
with
717 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
from .utils import get_random_name, run_coro, find_astro_sun_thing, get_bytes_text | ||
from .test_data import get_openhab_test_events, get_openhab_test_states, get_openhab_test_types | ||
from .utils import find_astro_sun_thing, get_random_name | ||
|
||
|
||
# isort: split | ||
|
||
from .test_rule import TestBaseRule, TestResult | ||
from .event_waiter import EventWaiter | ||
from .item_waiter import ItemWaiter | ||
from .openhab_tmp_item import OpenhabTmpItem | ||
|
||
from .test_data import get_openhab_test_events, get_openhab_test_states, get_openhab_test_types | ||
from .openhab_tmp_item import AsyncOpenhabTmpItem, OpenhabTmpItem | ||
from .test_rule import TestBaseRule, TestResult, TestRunnerRule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
from .utils import get_bytes_text | ||
from binascii import b2a_hex | ||
|
||
|
||
def get_equal_text(value1, value2) -> str: | ||
return f'{get_value_text(value1)} {"==" if value1 == value2 else "!="} {get_value_text(value2)}' | ||
def get_bytes_text(value: object) -> object: | ||
if isinstance(value, bytes) and len(value) > 300: | ||
return b2a_hex(value[:40]).decode() + ' ... ' + b2a_hex(value[-40:]).decode() | ||
return value | ||
|
||
|
||
def get_value_text(value) -> str: | ||
def get_equal_text(value1: object, value2: object) -> str: | ||
equal = value1 == value2 and isinstance(value1, value2.__class__) | ||
return f'{get_value_text(value1):s} {"==" if equal else "!="} {get_value_text(value2):s}' | ||
|
||
|
||
def get_value_text(value: object) -> str: | ||
return f'{get_bytes_text(value)} ({str(type(value))[8:-2]})' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
class TestCaseFailed(Exception): | ||
def __init__(self, msg: str) -> None: | ||
self.msg = msg | ||
|
||
|
||
class TestCaseWarning(Exception): | ||
class TestCaseFailed(Exception): # noqa: N818 | ||
def __init__(self, msg: str) -> None: | ||
self.msg = msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.