code: def test_parse_slice():
      assert parse_slice(None) == slice(None)
      assert parse_slice("1:5") == slice(1, 5)
      assert parse_slice("1:") == slice(1, None)
      assert parse_slice(":5") == slice(None, 5)
      assert parse_slice(":-1") == slice(None, -1)
      assert parse_slice("-5:-1") == slice(-5, -1)
      assert parse_slice("1:5:") == slice(1, 5, None)
      assert parse_slice("1::") == slice(1, None, None)
      assert parse_slice(":5:") == slice(None, 5, None)
      assert parse_slice(":-1:") == slice(None, -1, None)
      assert parse_slice("-5:-1:") == slice(-5, -1, None)
      assert parse_slice("1:5:1") == slice(1, 5, 1)
      assert parse_slice("1::1") == slice(1, None, 1)
      assert parse_slice(":5:1") == slice(None, 5, 1)
      assert parse_slice(":-1:1") == slice(None, -1, 1)
      assert parse_slice("-5:-1:1") == slice(-5, -1, 1)
      assert parse_slice("5:1:-1") == slice(5, 1, -1)
      assert parse_slice(":1:-1") == slice(None, 1, -1)
      assert parse_slice("5::-1") == slice(5, None, -1)
      assert parse_slice("-1::-1") == slice(-1, None, -1)
      assert parse_slice("-1:-5:-1") == slice(-1, -5, -1)
  
      # Max of start:stop:step
      with pytest.raises(ValueError):
          parse_slice("1:2:3:4")
      # Integers only
      with pytest.raises(ValueError):
          parse_slice("abc:2:3")
      with pytest.raises(ValueError):
          parse_slice("1.2:2:3")
      # Unit steps only
      with pytest.raises(ValueError):
          parse_slice("1:5:2")
  
file_path: nibabel/nibabel/cmdline/tests/test_roi.py
imports: import os
  import unittest
  from unittest import mock
  import numpy
  import pytest
  import nibabel
  from nibabel.cmdline.roi import lossless_slice, main, parse_slice
  from nibabel.testing import data_path
label_desc: Use image node_id 1 for calling a global function with example usage: test_parse_slice() without return types