code: def test_valid(self):
      # Simple split:
      ri = self.check_from_spec("train", [("train", None, None)])
      self.assertEqual(
          str(ri),
          "ReadInstruction('train')",
      )
      self.check_from_spec("test", [("test", None, None)])
      # Addition of splits:
      self.check_from_spec(
          "train+test",
          [
              ("train", None, None),
              ("test", None, None),
          ],
      )
      # Absolute slicing:
      self.check_from_spec("train[0:0]", [("train", None, 0)])
      self.check_from_spec("train[:10]", [("train", None, 10)])
      self.check_from_spec("train[0:10]", [("train", None, 10)])
      self.check_from_spec("train[-10:]", [("train", 190, None)])
      self.check_from_spec("train[-100:-50]", [("train", 100, 150)])
      self.check_from_spec("train[-10:200]", [("train", 190, None)])
      self.check_from_spec("train[10:-10]", [("train", 10, 190)])
      self.check_from_spec("train[42:99]", [("train", 42, 99)])
      # Percent slicing, closest rounding:
      self.check_from_spec("train[:10%]", [("train", None, 20)])
      self.check_from_spec("train[90%:]", [("train", 180, None)])
      self.check_from_spec("train[-1%:]", [("train", 198, None)])
      ri = self.check_from_spec("test[:99%]", [("test", None, 100)])
      self.assertEqual(
          str(ri), "ReadInstruction('test[:99%]', rounding='closest')"
      )
      self.check_from_spec("train[:0.5%]", [("train", None, 1)])
      # No overlap:
      self.check_from_spec("test[100%:]", [("test", 101, None)])
      # Percent slicing, pct1_dropremainder rounding:
      ri = splits.ReadInstruction(
          "train", to=20, unit="%", rounding="pct1_dropremainder"
      )
      self.check_from_ri(ri, [("train", None, 40)])
      # test split has 101 examples.
      ri = splits.ReadInstruction(
          "test", to=100, unit="%", rounding="pct1_dropremainder"
      )
      self.check_from_ri(ri, [("test", None, 100)])
      # No overlap using 'pct1_dropremainder' rounding:
      ri1 = splits.ReadInstruction(
          "test", to=99, unit="%", rounding="pct1_dropremainder"
      )
      ri2 = splits.ReadInstruction(
          "test", from_=100, unit="%", rounding="pct1_dropremainder"
      )
      self.check_from_ri(ri1, [("test", None, 99)])
      self.check_from_ri(ri2, [("test", 100, None)])
      # Empty:
      # Slices resulting in empty datasets are valid with 'closest' rounding:
      self.check_from_spec("validation[:1%]", [("validation", None, 0)])
      # New integer syntax
      self.check_from_spec("train[4_2:9_9]", [("train", 42, 99)])
      self.check_from_spec("train[:1_0%]", [("train", None, 20)])
  
      # Supports splits with '-' in name.
      ri = self.check_from_spec(
          "dev-train", [("dev-train", None, None)]
      )
  
imports: from tensorflow_datasets import testing
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import proto
  from tensorflow_datasets.core import splits
  from tensorflow_datasets.core.utils import shard_utils
  import tensorflow_datasets.public_api
label_desc: Use image node_id 5 for calling the ReadInstructionTest obj's underlying member method code with example usage: obj.test_valid() without return types