code: def test_set_from_json_keeps_mode(self) -> None:
      class Foo(HasProps):
          x = bcpd.NumberSpec(default=-1)
  
      a = Foo()
  
      assert a.x == -1
  
      # set as a value
      a.x = 14
      assert a.x == 14
      # set_from_json keeps the previous dict-ness or lack thereof
      a.set_from_json("x", dict(value=16))
      assert a.x == 16
      # but regular assignment overwrites the previous dict-ness
      a.x = dict(value=17)
      assert a.x == value(17)
  
      # set as a field
      a.x = "bar"
      assert a.x == "bar"
      # set_from_json keeps the previous dict-ness or lack thereof
      a.set_from_json("x", dict(field="foo"))
      assert a.x == "foo"
      # but regular assignment overwrites the previous dict-ness
      a.x = dict(field="baz")
      assert a.x == field("baz")
  
imports: from __future__ import annotations
  import pytest
  import datetime
  import warnings
  from copy import copy
  import numpy
  import pandas
  from bokeh.core.has_props import HasProps, Local
  from bokeh.core.property.vectorization import Field, Value, field, value
  from tests.support.util.api import verify_all
  import bokeh.core.property.dataspec
label_desc: Use image node_id 8 for calling the Test_NumberSpec obj's underlying member method code with example usage: obj.test_set_from_json_keeps_mode() without return types