code: def test_library():
      tokenize_test = lambda x: tokenize_descriptor(x)[
          :-1
      ]  # remove 'end of string'
      assert tokenize_test("hi") == ["hi"]
      assert tokenize_test("hi there") == ["hi", "there"]
      assert tokenize_test("hi,there") == ["hi", ",", "there"]
      assert tokenize_test("hi@-1,there") == [
          "hi",
          "@",
          "-1",
          ",",
          "there",
      ]
      assert tokenize_test("hi(there)") == ["hi", "(", "there", ")"]
      assert tokenize_descriptor("[-1]@2", ["foo", "bar"])[:-1] == [
          "bar",
          "@",
          "2",
      ]
      assert tokenize_descriptor("[-2].special@2", ["foo", "bar"])[
          :-1
      ] == ["foo.special", "@", "2"]
  
      assert Descriptor("foo").str() == "foo"
      assert Descriptor("Sum(foo,bar)").str() == "Sum(foo, bar)"
      assert (
          Descriptor("Sum(Offset(foo,1),Offset(foo,0))").str()
          == "Sum(Offset(foo, 1), Offset(foo, 0))"
      )
      for x in [
          "Append(foo, Sum(bar, Offset(baz, 1)))",
          "Failover(foo, Offset(bar, -1))",
          "IfDefined(Round(baz, 3))",
          "Switch(foo1, Offset(foo2, 2), Offset(foo3, 3))",
          "IfDefined(ReplaceIndex(ivector, t, 0))",
          "ReplaceIndex(foo, x, 0)",
      ]:
          if not Descriptor(x).str() == x:
              print(
                  "Error: '{0}' != '{1}'".format(Descriptor(x).str(), x)
              )
  
      prev_names = ["last_but_one_layer", "prev_layer"]
      for x, y in [
          ("Sum(foo,bar)", "Sum(foo, bar)"),
          ("Sum(foo1,bar-3_4)", "Sum(foo1, bar-3_4)"),
          (
              "Append(input@-3, input@0, input@3)",
              "Append(Offset(input, -3), input, Offset(input, 3))",
          ),
          (
              "Append(-3,0,3)",
              "Append(Offset(prev_layer, -3), prev_layer, Offset(prev_layer, 3))",
          ),
          ("[-1]", "prev_layer"),
          ("Scale(2.0,foo)", "Scale(2.0, foo)"),
          ("Const(0.5,500)", "Const(0.5, 500)"),
          ("[-2]", "last_but_one_layer"),
          ("[-2]@3", "Offset(last_but_one_layer, 3)"),
      ]:
          if not Descriptor(x, prev_names).str() == y:
              print(
                  "Error: '{0}' != '{1}'".format(Descriptor(x).str(), y)
              )
  
      print(
          parse_config_line(
              "affine-layer input=Append(foo, bar) foo=bar"
          )
      )
      print(
          parse_config_line(
              'affine-layer x="y z" input=Append(foo, bar) foo=bar opt2="a=1 b=2"'
          )
      )
      print(
          parse_config_line(
              "affine-layer1 input=Append(foo, bar) foo=bar"
          )
      )
      print(parse_config_line("affine-layer"))
  
imports: from __future__ import print_function
  from __future__ import division
  import re
  import sys
label_desc: Use image node_id 12 for calling a global function with example usage: test_library() without return types