def check_str_endswith(string: str, suffix: str, start: Optional[int], end: Optional[int]) -> ResultComparison: """ post: _ """ return compare_results( lambda s, *a: s.endswith(*a), string, )
def check_eval(e: str, g: Optional[Dict[str, Any]], l: Optional[Dict[str, Any]]): """ pre: len(e) == 1 post: _ """ return compare_results(eval, e, {}, {})
def check_str_rfind_empty(big: str, start: int, end: int): """ post: _ """ # Lots of tricky edge cases when searching for an empty string. # Target these cases more narrowly. if big != "": return True return compare_results(lambda s, *a: s.rfind("", *a), big, start, end)
def check_max(x: Sequence, k: Optional[Callable[[Any], Any]], d: object) -> ResultComparison: """ post: _ """ kw = {"default": d} if k is not None: kw["key"] = k return compare_results(max, x, **kw)
def check_setitem_bytearray_add_self(container: bytearray): """ post: _ """ def setter(c): c[0:0] = c return c return compare_results(setter, container)
def check_inplace_mutation(container: Union[bytearray, List[int], Dict[int, int]]): """ post: _ """ def setter(c): if c: c[0] &= 42 return c return compare_results(setter, container)
def check_str_startswith( string: str, prefix: Union[str, Tuple[str, ...]], start: Optional[int], end: Optional[int], ) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a, **kw: s.startswith(*a, **kw), string, prefix, start, end)
def check_hash(o: object) -> ResultComparison: """ post: _ """ return compare_results(hash, o)
def check_float(o: Union[str, int, float]) -> ResultComparison: """ post: _ """ # TODO this isn't hitting most of the branches we care about right now. return compare_results(float, o)
def check_and(left: int): """ post: _ """ return compare_results(lambda l: (l & 3, 4 & l), left)
def check_str_removesuffix(s: str, suffix: str): """ post: _ """ return compare_results(lambda s, *a: s.removesuffix(*a), s, suffix)
def check_divmod(x: Union[int, float]) -> ResultComparison: """ post: _ """ return compare_results(divmod, x)
def check_str_rindex( string: str, sub: str, start: Optional[int], end: Optional[int] ) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a: s.rindex(*a), string, sub, start, end)
def check_str_replace( string: str, old: str, new: str, maxsplit: int ) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a: s.replace(*a), string, old, new, maxsplit)
def check_str_lower(string: str) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a: s.lower(*a), string)
def check_str_upper(string: str) -> ResultComparison: """ post: _ """ return compare_results(lambda s: s.upper(), string)
def check_str_zfill(string: str, width: int) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a: s.zfill(*a), string, width)
def check_str_rjust(string: str, width: int, fill: str) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a: s.rjust(*a), string, width, fill)
def check_getitem_return_type(container: Union[bytes, bytearray]): """ post: _ """ return compare_results(lambda c: type(c[:1]), container)
def check_str_rpartition(string: str, sep: str) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a: s.rpartition(*a), string, sep)
def check_add_bytearray_return_type(container: bytearray): """ post: _ """ return compare_results(lambda c: type(c + b"abc"), container)
def check_str_split(string: str, sep: str, maxsplit: int) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a: s.split(*a), string, sep, maxsplit)
def check_getitem( container: Union[Dict[int, int], List[int], Tuple[int, ...]], key: int ): """ post: _ """ return compare_results(lambda d, k: d[k], container, key)
def check_str_splitlines(string: str, keepends: bool) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a: s.splitlines(*a), string, keepends)
def check_eq_atomic( left: Union[bool, int, float, str], right: Union[bool, int, float, str] ): """ post: _ """ return compare_results(lambda a, b: a == b, left, right)
def check_str_strip(string: str, chars: str) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a: s.strip(*a), string, chars)
def check_format(x: object, f: str) -> ResultComparison: """ post: _ """ return compare_results(format, x, f)
def check_str_title(string: str) -> ResultComparison: """ post: _ """ return compare_results(lambda s: s.title(), string)
def check_hex(o: int) -> ResultComparison: """ post: _ """ return compare_results(hex, o)
def check_str_translate( string: str, tbl: Union[Mapping[int, int], List[str]] ) -> ResultComparison: """ post: _ """ return compare_results(lambda s, *a: s.translate(*a), string, tbl)