code: def test_dtype_constr_errors(self):
      # Create a symbol table with no types in it, so we can
      # make some isolated type constructors for testing
      sym = datashape.TypeSymbolTable(bare=True)
      # A limited set of dtypes for testing
      sym.dtype["int8"] = ct.int8
      sym.dtype["uint16"] = ct.uint16
      sym.dtype["float64"] = ct.float64
      # Arbitrary dtype constructor that does nothing
  
      def _type_constr(*args, **kwargs):
          return ct.float32
  
      sym.dtype_constr["tcon"] = _type_constr
  
      # Require closing "]"
      self.assertRaises(DataShapeSyntaxError, parse, "tcon[", sym)
      # Type constructors should always have an argument
      self.assertRaises(DataShapeSyntaxError, parse, "tcon[]", sym)
      # Unknown type
      self.assertRaises(
          DataShapeSyntaxError, parse, "tcon[unknown]", sym
      )
      # Missing parameter value
      self.assertRaises(DataShapeSyntaxError, parse, "tcon[x=", sym)
      self.assertRaises(DataShapeSyntaxError, parse, "tcon[x=]", sym)
      # A positional arg cannot be after a keyword arg
      self.assertRaises(
          DataShapeSyntaxError, parse, "tcon[x=A, B]", sym
      )
      # List args must be homogeneous
      self.assertRaises(
          DataShapeSyntaxError, parse, 'tcon[[0, "x"]]', sym
      )
      self.assertRaises(
          DataShapeSyntaxError, parse, "tcon[[0, X]]", sym
      )
      self.assertRaises(
          DataShapeSyntaxError, parse, 'tcon[["x", 0]]', sym
      )
      self.assertRaises(
          DataShapeSyntaxError, parse, 'tcon[["x", X]]', sym
      )
      self.assertRaises(
          DataShapeSyntaxError, parse, "tcon[[X, 0]]", sym
      )
      self.assertRaises(
          DataShapeSyntaxError, parse, 'tcon[[X, "x"]]', sym
      )
  
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 3 for calling the TestDataShapeParserDTypeConstr obj's underlying member method code with example usage: obj.test_dtype_constr_errors() and returns: ct