Пример #1
0
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
Пример #2
0
    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"))
Пример #3
0
    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"))
Пример #4
0
    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"])
Пример #5
0
def test_bool_or_value_keep_false_int():
    assert bool_or_value(0) == 0
Пример #6
0
def test_bool_or_value_keep_none():
    assert bool_or_value(None) is None
Пример #7
0
def test_bool_or_value_keep_string_value():
    assert bool_or_value("mem") == "mem"
Пример #8
0
def test_bool_or_value_false_is_false():
    assert bool_or_value("false") is False
Пример #9
0
def test_bool_or_value_true_is_true():
    assert bool_or_value("true") is True
Пример #10
0
def test_bool_or_value_keep_true_int():
    assert bool_or_value(1) == 1