code: def test_struct(self):
      # Simple struct
      self.assertEqual(
          parse("{x: int16, y: int32}", self.sym),
          ct.DataShape(
              ct.Record(
                  [
                      ("x", ct.DataShape(ct.int16)),
                      ("y", ct.DataShape(ct.int32)),
                  ]
              )
          ),
      )
      # A trailing comma is ok
      self.assertEqual(
          parse("{x: int16, y: int32,}", self.sym),
          ct.DataShape(
              ct.Record(
                  [
                      ("x", ct.DataShape(ct.int16)),
                      ("y", ct.DataShape(ct.int32)),
                  ]
              )
          ),
      )
      # Field names starting with _ and caps
      self.assertEqual(
          parse("{_x: int16, Zed: int32,}", self.sym),
          ct.DataShape(
              ct.Record(
                  [
                      ("_x", ct.DataShape(ct.int16)),
                      ("Zed", ct.DataShape(ct.int32)),
                  ]
              )
          ),
      )
      # A slightly bigger example
      ds_str = """3 * var * {
                          id : int32,
                          name : string,
                          description : {
                              language : string,
                              text : string
                          },
                          entries : var * {
                              date : date,
                              text : string
                          }
                      }"""
      int32 = ct.DataShape(ct.int32)
      string = ct.DataShape(ct.string)
      date = ct.DataShape(ct.date_)
      ds = (
          ct.Fixed(3),
          ct.Var(),
          ct.Record(
              [
                  ("id", int32),
                  ("name", string),
                  (
                      "description",
                      ct.DataShape(
                          ct.Record(
                              [("language", string), ("text", string)]
                          )
                      ),
                  ),
                  (
                      "entries",
                      ct.DataShape(
                          ct.Var(),
                          ct.Record([("date", date), ("text", string)]),
                      ),
                  ),
              ]
          ),
      )
      self.assertEqual(parse(ds_str, self.sym), ct.DataShape(*ds))
  
imports: from __future__ import absolute_import, division, print_function
  import unittest
  import pytest
  from datashader import datashape
  from datashader.datashape.util.testing import assert_dshape_equal
  from datashader.datashape.parser import parse
  from datashader.datashape import coretypes
  from datashader.datashape import DataShapeSyntaxError
label_desc: Use image node_id 2 for calling the TestDataShapeParseStruct obj's underlying member method code with example usage: obj.test_struct() without return types