Пример #1
0
def ids_from_input(ids_input):
    """Return the list of IDs to check for from user-input.

    :param ids_input: Comma-separated list of requested record IDs.
        May contain, or be ALL.
    :type  ids_input: str

    :returns: intbitset of IDs or ALL
    :rtype:   seq

    :raises:  ValueError
    """
    if ALL in ids_input.split(','):
        from invenio_checker.common import ALL
        return ALL
    else:
        from invenio_utils.shell import split_cli_ids_arg
        return intbitset(split_cli_ids_arg(ids_input), sanity_checks=True)
Пример #2
0
def ids_from_input(ids_input):
    """Return the list of IDs to check for from user-input.

    :param ids_input: Comma-separated list of requested record IDs.
        May contain, or be ALL.
    :type  ids_input: str

    :returns: intbitset of IDs or ALL
    :rtype:   seq

    :raises:  ValueError
    """
    if ALL in ids_input.split(','):
        from invenio_checker.common import ALL
        return ALL
    else:
        from invenio_utils.shell import split_cli_ids_arg
        return intbitset(split_cli_ids_arg(ids_input), sanity_checks=True)
Пример #3
0
 def test_complex(self):
     self.assertEqual(split_cli_ids_arg("1-1,7,10-11,4"), set([1, 4, 7, 10, 11]))
Пример #4
0
 def test_multiple(self):
     self.assertEqual(split_cli_ids_arg("1,5,7"), set([1, 5, 7]))
Пример #5
0
 def test_range(self):
     self.assertEqual(split_cli_ids_arg("1-5"), set([1, 2, 3, 4, 5]))
Пример #6
0
 def test_one(self):
     self.assertEqual(split_cli_ids_arg("1"), set([1]))