code: def test_parselinenos():
      assert parselinenos("1,2,3", 10) == [0, 1, 2]
      assert parselinenos("4, 5, 6", 10) == [3, 4, 5]
      assert parselinenos("-4", 10) == [0, 1, 2, 3]
      assert parselinenos("7-9", 10) == [6, 7, 8]
      assert parselinenos("7-", 10) == [6, 7, 8, 9]
      assert parselinenos("1,7-", 10) == [0, 6, 7, 8, 9]
      assert parselinenos("7-7", 10) == [6]
      assert parselinenos("11-", 10) == [10]
      with pytest.raises(
          ValueError, match="invalid line number spec: '1-2-3'"
      ):
          parselinenos("1-2-3", 10)
      with pytest.raises(
          ValueError, match="invalid line number spec: 'abc-def'"
      ):
          parselinenos("abc-def", 10)
      with pytest.raises(
          ValueError, match="invalid line number spec: '-'"
      ):
          parselinenos("-", 10)
      with pytest.raises(
          ValueError, match="invalid line number spec: '3-1'"
      ):
          parselinenos("3-1", 10)
  
file_path: sphinx/tests/test_util/test_util.py
imports: import os
  import tempfile
  import pytest
  from sphinx.errors import ExtensionError
  from sphinx.util import encode_uri, ensuredir, import_object, parselinenos
label_desc: Use image node_id 4 for calling a global function with example usage: test_parselinenos() without return types