From 3bfeeb2f7032d702589ec1c31a10c6fb7dff5cb1 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Mon, 5 Dec 2022 22:11:30 +0200 Subject: [PATCH 1/6] additional expectations --- src/expycted/internals/base.py | 4 +- src/expycted/internals/utils.py | 3 +- src/expycted/internals/value.py | 57 +++++++++++++++++++++++-- test/expect_to_not_test_suite.py | 41 +++++++++++++++++- test/expect_to_test_suite.py | 58 +++++++++++++++++++++++++ test/helpers/stubs.py | 72 ++++++++++++++++++++++++++++++-- 6 files changed, 224 insertions(+), 11 deletions(-) diff --git a/src/expycted/internals/base.py b/src/expycted/internals/base.py index f09c11f..81de77e 100644 --- a/src/expycted/internals/base.py +++ b/src/expycted/internals/base.py @@ -38,7 +38,7 @@ def _assert(self, result: bool, message: str): assert result, message self.negate = False - + return self @hidetraceback @@ -59,7 +59,7 @@ def and_to(self): @property def to_not(self): - self.negate = not self.negate + self.negate = True return self @property diff --git a/src/expycted/internals/utils.py b/src/expycted/internals/utils.py index 9fa11f3..5299c2d 100644 --- a/src/expycted/internals/utils.py +++ b/src/expycted/internals/utils.py @@ -12,10 +12,11 @@ def hidetraceback(fn: Callable) -> Callable: Returns: Callable: The decorated function """ + __tracebackhide__ = os.getenv('EXPYCTED_HIDETRACEBACK', True) @wraps(fn) def _(*args, **kwargs): - fn.__globals__['__tracebackhide__'] = os.getenv('EXPYCTED_HIDETRACEBACK', True) + fn.__globals__['__tracebackhide__'] = __tracebackhide__ return fn(*args, **kwargs) diff --git a/src/expycted/internals/value.py b/src/expycted/internals/value.py index 1b882cc..cf82317 100644 --- a/src/expycted/internals/value.py +++ b/src/expycted/internals/value.py @@ -1,7 +1,7 @@ import pickle from typing import Any, Collection, Tuple -from expycted.internals.utils import assertion +from expycted.internals.utils import assertion, hidetraceback from expycted.internals.base import BaseExpectation @@ -76,10 +76,10 @@ def _internal_be_false(self) -> Tuple[bool, str]: return self.expected is False, self._message("be_false") def _internal_be_truthy(self) -> Tuple[bool, str]: - return True if self.expected else False, self._message("be_truthy") + return bool(self.expected), self._message("be_truthy") def _internal_be_falsey(self) -> Tuple[bool, str]: - return True if not self.expected else False, self._message("be_falsey") + return not bool(self.expected), self._message("be_falsey") def _internal_be_of_type(self, actual: type) -> Tuple[bool, str]: return type(self.expected) is actual, self._message("be_of_type", actual) @@ -275,10 +275,61 @@ def be_numeric(self) -> None: bool: Result """ + @hidetraceback + def be_list(self) -> None: + """Check whether the value is a list + + Returns: + bool: Result + """ + return self.be_of_type(list) + + @hidetraceback + def be_bool(self) -> None: + """Check whether the value is a bool + + Returns: + bool: Result + """ + return self.be_of_type(bool) + + @hidetraceback + def be_int(self) -> None: + """Check whether the value is an int + + Returns: + bool: Result + """ + return self.be_of_type(int) + + @hidetraceback + def be_float(self) -> None: + """Check whether the value is a float + + Returns: + bool: Result + """ + return self.be_of_type(float) + + @hidetraceback + def be_str(self) -> None: + """Check whether the value is a str + + Returns: + bool: Result + """ + return self.be_of_type(str) + # Aliases be_a_number = be_numeric + be_a_list = be_list + be_a_bool = be_bool + be_an_int = be_int + be_a_float = be_float + be_a_str = be_str + be_lesser = be_less = be_less_than = be_lesser_than be_lesser_or_equal = ( be_less_or_equal diff --git a/test/expect_to_not_test_suite.py b/test/expect_to_not_test_suite.py index dfb4611..d6fc29b 100644 --- a/test/expect_to_not_test_suite.py +++ b/test/expect_to_not_test_suite.py @@ -92,7 +92,6 @@ def test_to_not_inherit(expected, actual, context): expect(expected).to.inherit(actual) - @expected_actual_params(stubs.LESS_THAN, extract_ids=False) def test_to_not_be_greater_than(expected, actual, context): expect(expected).to_not.be_greater_than(actual) @@ -115,3 +114,43 @@ def test_to_not_be_numeric(expected, context): with context.raises: expect(expected).to.be_numeric() + + +@expected_params(stubs.NOT_LIST, extract_ids=False) +def test_to_not_be_list(expected, context): + expect(expected).to_not.be_list() + + with context.raises: + expect(expected).to.be_list() + + +@expected_params(stubs.NOT_BOOL, extract_ids=False) +def test_to_not_be_bool(expected, context): + expect(expected).to_not.be_bool() + + with context.raises: + expect(expected).to.be_bool() + + +@expected_params(stubs.NOT_INT, extract_ids=False) +def test_to_not_be_int(expected, context): + expect(expected).to_not.be_int() + + with context.raises: + expect(expected).to.be_int() + + +@expected_params(stubs.NOT_FLOAT, extract_ids=False) +def test_to_not_be_float(expected, context): + expect(expected).to_not.be_float() + + with context.raises: + expect(expected).to.be_float() + + +@expected_params(stubs.NOT_STR, extract_ids=False) +def test_to_not_be_str(expected, context): + expect(expected).to_not.be_str() + + with context.raises: + expect(expected).to.be_str() diff --git a/test/expect_to_test_suite.py b/test/expect_to_test_suite.py index 2dca294..0329c84 100644 --- a/test/expect_to_test_suite.py +++ b/test/expect_to_test_suite.py @@ -250,3 +250,61 @@ def test_to_be_numeric(expected, context): with context.raises: expect(expected).to_not.be_a_number() + + +@expected_params(stubs.LIST, extract_ids=False) +def test_to_be_list(expected, context): + expect(expected).to.be_list() + expect(expected).to.be_a_list() + + with context.raises: + expect(expected).to_not.be_list() + + with context.raises: + expect(expected).to_not.be_a_list() + + +@expected_params(stubs.BOOL, extract_ids=False) +def test_to_be_list(expected, context): + expect(expected).to.be_bool() + expect(expected).to.be_a_bool() + + with context.raises: + expect(expected).to_not.be_bool() + + with context.raises: + expect(expected).to_not.be_a_bool() + + +@expected_params(stubs.INT, extract_ids=False) +def test_to_be_int(expected, context): + expect(expected).to.be_int() + expect(expected).to.be_an_int() + + with context.raises: + expect(expected).to_not.be_int() + + with context.raises: + expect(expected).to_not.be_an_int() + +@expected_params(stubs.FLOAT, extract_ids=False) +def test_to_be_float(expected, context): + expect(expected).to.be_float() + expect(expected).to.be_a_float() + + with context.raises: + expect(expected).to_not.be_float() + + with context.raises: + expect(expected).to_not.be_a_float() + +@expected_params(stubs.STR, extract_ids=False) +def test_to_be_str(expected, context): + expect(expected).to.be_str() + expect(expected).to.be_a_str() + + with context.raises: + expect(expected).to_not.be_str() + + with context.raises: + expect(expected).to_not.be_a_str() \ No newline at end of file diff --git a/test/helpers/stubs.py b/test/helpers/stubs.py index 2c3b830..4afdbfb 100644 --- a/test/helpers/stubs.py +++ b/test/helpers/stubs.py @@ -20,15 +20,14 @@ def __init__(self, first_name="John", last_name="Doe"): INT_STR_EQUIVALENT = (1, "1", "int str equivalent") INT_FLOAT_EQUIVALENT = (1, 1.0, "int float equivalent") -RSTR_STR_EQUIVALENT = (r"hello","hello", "r-str str equivalent") -BYTE_STR_EQUIVALENT = (b"hello","hello", "byte-str str equivalent") +RSTR_STR_EQUIVALENT = (r"hello", "hello", "r-str str equivalent") +BYTE_STR_EQUIVALENT = (b"hello", "hello", "byte-str str equivalent") LIST_TUPLE_EQUIVALENT = ([True, 1.1], (True, 1.1), "list tuple equivalent") SAME_OBJECT = (PERSON, PERSON, "same object in memory") COPY_OBJECT = (Person(), Person(), "copied object") - EQUAL = ( TRUE_INT_EQUIVALENT, FALSE_INT_EQUIVALENT, @@ -97,6 +96,7 @@ def __init__(self, first_name="John", last_name="Doe"): set(), "", tuple(), + range(0), ) NOT_EMPTY = ( @@ -105,6 +105,7 @@ def __init__(self, first_name="John", last_name="Doe"): [1], {1}, (1,), + range(10) ) NOT_EMPTY_TYPE_ERROR = ( @@ -156,6 +157,17 @@ def __init__(self, first_name="John", last_name="Doe"): PERSON ) +BOOL = ( + *TRUE, + *FALSE +) + +NOT_BOOL = ( + "True", + 0, + 1 +) + TYPE = ( ([1], list), (2, int), @@ -246,4 +258,56 @@ def __init__(self, first_name="John", last_name="Doe"): tuple(), lambda x: x, PERSON -) \ No newline at end of file +) + +LIST = ( + [1, 2], + ["hello"], + [] +) + +NOT_LIST = ( + "string", + (1, 2), + {1, 2}, + PERSON +) + +INT = ( + -1, + 0, + 1, + 1_000_123 +) + +FLOAT = ( + -1.0, + 0.0, + 1e1, + 1.0, + 1.1 +) + +NOT_INT = ( + *FLOAT, + "1", +) + +NOT_FLOAT = ( + *INT, + "1.1" +) + +STR = ( + "", + " ", + "hello", + r"hello" +) + +NOT_STR = ( + *INT, + *FLOAT, + *BOOL, + *LIST +) From 40d3ac3b9dd335b86feef86700a8a2a50ca7adc4 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Mon, 5 Dec 2022 22:16:28 +0200 Subject: [PATCH 2/6] added callable assertion --- src/expycted/internals/value.py | 12 ++++++++++++ test/expect_to_not_test_suite.py | 8 ++++++++ test/expect_to_test_suite.py | 12 +++++++++++- test/helpers/stubs.py | 13 +++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/expycted/internals/value.py b/src/expycted/internals/value.py index cf82317..fca559e 100644 --- a/src/expycted/internals/value.py +++ b/src/expycted/internals/value.py @@ -23,6 +23,7 @@ class Value(BaseExpectation): "be_greater_or_equal_to": "Expected {expected} to be greater than or equal to {actual}", "be_lesser_or_equal_to": "Expected {expected} to be less than or equal to {actual}", "be_numeric": "Expected {expected} to be numeric", + "be_callable": "Expected {expected} to be callable", } def _internal_has_len(self: Any) -> bool: @@ -117,6 +118,9 @@ def _internal_be_numeric(self: Any) -> Tuple[bool, str]: return False, assertion_text + def _internal_be_callable(self) -> Tuple[bool, str]: + return callable(self.expected), self._message("be_callable") + @assertion def equal(self, actual: Any) -> None: """Checks whether that the value is equal to something @@ -275,6 +279,14 @@ def be_numeric(self) -> None: bool: Result """ + @assertion + def be_callable(self) -> None: + """Check whether the value is callable + + Returns: + bool: Result + """ + @hidetraceback def be_list(self) -> None: """Check whether the value is a list diff --git a/test/expect_to_not_test_suite.py b/test/expect_to_not_test_suite.py index d6fc29b..20b7f6b 100644 --- a/test/expect_to_not_test_suite.py +++ b/test/expect_to_not_test_suite.py @@ -154,3 +154,11 @@ def test_to_not_be_str(expected, context): with context.raises: expect(expected).to.be_str() + + +@expected_params(stubs.NOT_CALLABLE, extract_ids=False) +def test_to_not_be_callable(expected, context): + expect(expected).to_not.be_callable() + + with context.raises: + expect(expected).to.be_callable() diff --git a/test/expect_to_test_suite.py b/test/expect_to_test_suite.py index 0329c84..541b061 100644 --- a/test/expect_to_test_suite.py +++ b/test/expect_to_test_suite.py @@ -287,6 +287,7 @@ def test_to_be_int(expected, context): with context.raises: expect(expected).to_not.be_an_int() + @expected_params(stubs.FLOAT, extract_ids=False) def test_to_be_float(expected, context): expect(expected).to.be_float() @@ -298,6 +299,7 @@ def test_to_be_float(expected, context): with context.raises: expect(expected).to_not.be_a_float() + @expected_params(stubs.STR, extract_ids=False) def test_to_be_str(expected, context): expect(expected).to.be_str() @@ -307,4 +309,12 @@ def test_to_be_str(expected, context): expect(expected).to_not.be_str() with context.raises: - expect(expected).to_not.be_a_str() \ No newline at end of file + expect(expected).to_not.be_a_str() + + +@expected_params(stubs.CALLABLE, extract_ids=False) +def test_to_be_callable(expected, context): + expect(expected).to.be_callable() + + with context.raises: + expect(expected).to_not.be_callable() diff --git a/test/helpers/stubs.py b/test/helpers/stubs.py index 4afdbfb..4812e19 100644 --- a/test/helpers/stubs.py +++ b/test/helpers/stubs.py @@ -311,3 +311,16 @@ def __init__(self, first_name="John", last_name="Doe"): *BOOL, *LIST ) + +CALLABLE = ( + Person, + lambda x: x, + print +) + +NOT_CALLABLE = ( + *INT, + *FLOAT, + *BOOL, + *LIST +) From 5e9028303618003f6d02fb06a6727b62c82a9ce6 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Tue, 6 Dec 2022 09:18:08 +0200 Subject: [PATCH 3/6] Added be_none --- src/expycted/internals/base.py | 1 + src/expycted/internals/value.py | 10 ++++++++++ test/expect_to_not_test_suite.py | 8 ++++++++ test/expect_to_test_suite.py | 8 ++++++++ test/helpers/stubs.py | 11 +++++++++++ 5 files changed, 38 insertions(+) diff --git a/src/expycted/internals/base.py b/src/expycted/internals/base.py index 81de77e..5534ab4 100644 --- a/src/expycted/internals/base.py +++ b/src/expycted/internals/base.py @@ -51,6 +51,7 @@ def _execute_internal_assertion(self, method: str, *args, **kwargs): @property def to(self): + self.negate = False return self @property diff --git a/src/expycted/internals/value.py b/src/expycted/internals/value.py index fca559e..fbae7f9 100644 --- a/src/expycted/internals/value.py +++ b/src/expycted/internals/value.py @@ -332,6 +332,16 @@ def be_str(self) -> None: """ return self.be_of_type(str) + + @hidetraceback + def be_none(self) -> None: + """Check whether the value is None + + Returns: + bool: Result + """ + return self.be_of_type(type(None)) + # Aliases be_a_number = be_numeric diff --git a/test/expect_to_not_test_suite.py b/test/expect_to_not_test_suite.py index 20b7f6b..e7896ce 100644 --- a/test/expect_to_not_test_suite.py +++ b/test/expect_to_not_test_suite.py @@ -162,3 +162,11 @@ def test_to_not_be_callable(expected, context): with context.raises: expect(expected).to.be_callable() + + +@expected_params(stubs.NOT_NONE, extract_ids=False) +def test_to_not_be_none(expected, context): + expect(expected).to_not.be_none() + + with context.raises: + expect(expected).to.be_none() diff --git a/test/expect_to_test_suite.py b/test/expect_to_test_suite.py index 541b061..2b8d1fc 100644 --- a/test/expect_to_test_suite.py +++ b/test/expect_to_test_suite.py @@ -318,3 +318,11 @@ def test_to_be_callable(expected, context): with context.raises: expect(expected).to_not.be_callable() + + +@expected_params(stubs.NONE, extract_ids=False) +def test_to_be_none(expected, context): + expect(expected).to.be_none() + + with context.raises: + expect(expected).to_not.be_none() diff --git a/test/helpers/stubs.py b/test/helpers/stubs.py index 4812e19..bafe638 100644 --- a/test/helpers/stubs.py +++ b/test/helpers/stubs.py @@ -324,3 +324,14 @@ def __init__(self, first_name="John", last_name="Doe"): *BOOL, *LIST ) + +NONE = ( + None, +) + +NOT_NONE = ( + *FALSE, + *TRUE, + 0, + "" +) \ No newline at end of file From 954d61380251b37b87fdc5315c9c998bfff835e1 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Tue, 6 Dec 2022 09:45:32 +0200 Subject: [PATCH 4/6] Added be_set, be_tuple, be_dict --- src/expycted/internals/value.py | 32 +++++++++++++++++++++++ test/expect_to_not_test_suite.py | 24 +++++++++++++++++ test/expect_to_test_suite.py | 36 ++++++++++++++++++++++++++ test/helpers/stubs.py | 44 ++++++++++++++++++++++++++++++-- 4 files changed, 134 insertions(+), 2 deletions(-) diff --git a/src/expycted/internals/value.py b/src/expycted/internals/value.py index fbae7f9..fe73c45 100644 --- a/src/expycted/internals/value.py +++ b/src/expycted/internals/value.py @@ -287,6 +287,7 @@ def be_callable(self) -> None: bool: Result """ + @hidetraceback def be_list(self) -> None: """Check whether the value is a list @@ -296,6 +297,37 @@ def be_list(self) -> None: """ return self.be_of_type(list) + + @hidetraceback + def be_tuple(self) -> None: + """Check whether the value is a tuple + + Returns: + bool: Result + """ + return self.be_of_type(tuple) + + + @hidetraceback + def be_set(self) -> None: + """Check whether the value is a set + + Returns: + bool: Result + """ + return self.be_of_type(set) + + + @hidetraceback + def be_dict(self) -> None: + """Check whether the value is a dict + + Returns: + bool: Result + """ + return self.be_of_type(dict) + + @hidetraceback def be_bool(self) -> None: """Check whether the value is a bool diff --git a/test/expect_to_not_test_suite.py b/test/expect_to_not_test_suite.py index e7896ce..ff4f422 100644 --- a/test/expect_to_not_test_suite.py +++ b/test/expect_to_not_test_suite.py @@ -124,6 +124,30 @@ def test_to_not_be_list(expected, context): expect(expected).to.be_list() +@expected_params(stubs.NOT_TUPLE, extract_ids=False) +def test_to_not_be_tuple(expected, context): + expect(expected).to_not.be_tuple() + + with context.raises: + expect(expected).to.be_tuple() + + +@expected_params(stubs.NOT_SET, extract_ids=False) +def test_to_not_be_set(expected, context): + expect(expected).to_not.be_set() + + with context.raises: + expect(expected).to.be_set() + + +@expected_params(stubs.NOT_DICT, extract_ids=False) +def test_to_not_be_dict(expected, context): + expect(expected).to_not.be_dict() + + with context.raises: + expect(expected).to.be_dict() + + @expected_params(stubs.NOT_BOOL, extract_ids=False) def test_to_not_be_bool(expected, context): expect(expected).to_not.be_bool() diff --git a/test/expect_to_test_suite.py b/test/expect_to_test_suite.py index 2b8d1fc..d3f78b8 100644 --- a/test/expect_to_test_suite.py +++ b/test/expect_to_test_suite.py @@ -264,6 +264,42 @@ def test_to_be_list(expected, context): expect(expected).to_not.be_a_list() +@expected_params(stubs.TUPLE, extract_ids=False) +def test_to_be_tuple(expected, context): + expect(expected).to.be_tuple() + expect(expected).to.be_a_tuple() + + with context.raises: + expect(expected).to_not.be_tuple() + + with context.raises: + expect(expected).to_not.be_a_tuple() + + +@expected_params(stubs.SET, extract_ids=False) +def test_to_be_set(expected, context): + expect(expected).to.be_set() + expect(expected).to.be_a_set() + + with context.raises: + expect(expected).to_not.be_set() + + with context.raises: + expect(expected).to_not.be_a_set() + + +@expected_params(stubs.DICT, extract_ids=False) +def test_to_be_dict(expected, context): + expect(expected).to.be_dict() + expect(expected).to.be_a_dict() + + with context.raises: + expect(expected).to_not.be_dict() + + with context.raises: + expect(expected).to_not.be_a_dict() + + @expected_params(stubs.BOOL, extract_ids=False) def test_to_be_list(expected, context): expect(expected).to.be_bool() diff --git a/test/helpers/stubs.py b/test/helpers/stubs.py index bafe638..df10a07 100644 --- a/test/helpers/stubs.py +++ b/test/helpers/stubs.py @@ -266,13 +266,53 @@ def __init__(self, first_name="John", last_name="Doe"): [] ) -NOT_LIST = ( - "string", +TUPLE = ( (1, 2), + ("hello", ), + tuple() +) + +SET = ( + {"hello"}, {1, 2}, + set() +) + +DICT = ( + dict(), + {"a": 1}, +) + +NOT_LIST = ( + *TUPLE, + *SET, + *DICT, + "string", PERSON ) +NOT_TUPLE = ( + *LIST, + *SET, + *DICT, + "string", + PERSON +) + +NOT_SET = ( + *LIST, + *TUPLE, + *DICT, + "string", + PERSON +) + +NOT_DICT = ( + *TUPLE, + *SET, + *LIST, +) + INT = ( -1, 0, From 04cc41d5684c78b4e3f711754612a9bb36f56599 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Tue, 6 Dec 2022 09:53:38 +0200 Subject: [PATCH 5/6] Added alias --- src/expycted/internals/value.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/expycted/internals/value.py b/src/expycted/internals/value.py index fe73c45..0432d18 100644 --- a/src/expycted/internals/value.py +++ b/src/expycted/internals/value.py @@ -379,6 +379,9 @@ def be_none(self) -> None: be_a_number = be_numeric be_a_list = be_list + be_a_set = be_set + be_a_tuple = be_tuple + be_a_dict = be_dict be_a_bool = be_bool be_an_int = be_int be_a_float = be_float From 18e651d632852a3f0c0cd43c463eb7bf9a483c38 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Tue, 6 Dec 2022 10:29:31 +0200 Subject: [PATCH 6/6] wip --- src/expycted/internals/value.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/expycted/internals/value.py b/src/expycted/internals/value.py index 0432d18..72e5f58 100644 --- a/src/expycted/internals/value.py +++ b/src/expycted/internals/value.py @@ -23,7 +23,7 @@ class Value(BaseExpectation): "be_greater_or_equal_to": "Expected {expected} to be greater than or equal to {actual}", "be_lesser_or_equal_to": "Expected {expected} to be less than or equal to {actual}", "be_numeric": "Expected {expected} to be numeric", - "be_callable": "Expected {expected} to be callable", + "be_callable": "Expected {expected} to be callable function or method", } def _internal_has_len(self: Any) -> bool: @@ -271,6 +271,22 @@ def be_lesser_or_equal_to(self, actual: Any) -> None: bool: Result """ + @assertion + def startswith(self, prefix: str) -> None: + """Check whether the value starts with a given prefix + + Returns: + bool: Result + """ + + @assertion + def endswith(self, suffix: str) -> None: + """Check whether the value ends with a given suffix + + Returns: + bool: Result + """ + @assertion def be_numeric(self) -> None: """Check whether the value is numeric @@ -287,7 +303,6 @@ def be_callable(self) -> None: bool: Result """ - @hidetraceback def be_list(self) -> None: """Check whether the value is a list @@ -297,7 +312,6 @@ def be_list(self) -> None: """ return self.be_of_type(list) - @hidetraceback def be_tuple(self) -> None: """Check whether the value is a tuple @@ -307,7 +321,6 @@ def be_tuple(self) -> None: """ return self.be_of_type(tuple) - @hidetraceback def be_set(self) -> None: """Check whether the value is a set @@ -317,7 +330,6 @@ def be_set(self) -> None: """ return self.be_of_type(set) - @hidetraceback def be_dict(self) -> None: """Check whether the value is a dict @@ -327,7 +339,6 @@ def be_dict(self) -> None: """ return self.be_of_type(dict) - @hidetraceback def be_bool(self) -> None: """Check whether the value is a bool