def test_bool_or_value_true_is_true(value, expected): """ Test the `bool_or_value` function. Arguments: value: Value passed to the function. expected: The expected result. """ assert bool_or_value(value) == expected
def verify_integrity_pending(self) -> Optional[bool]: """ Return True if this download is waiting for the hash check in a queue. This key exists only when this download is in the queue. Returns: Whether this download is waiting for the hash check. """ return bool_or_value(self._struct.get("verifyIntegrityPending"))
def seeder(self) -> bool: """ Return True if the local endpoint is a seeder, otherwise false. BitTorrent only. Returns: If the local endpoint is a seeder. """ return bool_or_value(self._struct.get("seeder"))
def selected(self) -> bool: """ Return True if this file is selected by [`--select-file`][aria2p.options.Options.select_file] option. If [`--select-file`][aria2p.options.Options.select_file] is not specified or this is single-file torrent or not a torrent download at all, this value is always true. Otherwise false. Returns: If this file is selected. """ return bool_or_value(self._struct["selected"])
def test_bool_or_value_keep_false_int(): assert bool_or_value(0) == 0
def test_bool_or_value_keep_none(): assert bool_or_value(None) is None
def test_bool_or_value_keep_string_value(): assert bool_or_value("mem") == "mem"
def test_bool_or_value_false_is_false(): assert bool_or_value("false") is False
def test_bool_or_value_true_is_true(): assert bool_or_value("true") is True
def test_bool_or_value_keep_true_int(): assert bool_or_value(1) == 1