def test_json_options_with_options(self):
    opts = json_util.JSONOptions(datetime_representation=DatetimeRepresentation.NUMBERLONG)
    self.assertEqual(opts.datetime_representation, DatetimeRepresentation.NUMBERLONG)
    opts2 = opts.with_options(datetime_representation=DatetimeRepresentation.ISO8601)
    self.assertEqual(opts2.datetime_representation, DatetimeRepresentation.ISO8601)
    opts = json_util.JSONOptions(strict_number_long=True)
    self.assertEqual(opts.strict_number_long, True)
    opts2 = opts.with_options(strict_number_long=False)
    self.assertEqual(opts2.strict_number_long, False)
    opts = json_util.CANONICAL_JSON_OPTIONS
    self.assertNotEqual(opts.uuid_representation, UuidRepresentation.JAVA_LEGACY)
    opts2 = opts.with_options(uuid_representation=UuidRepresentation.JAVA_LEGACY)
    self.assertEqual(opts2.uuid_representation, UuidRepresentation.JAVA_LEGACY)
    self.assertEqual(opts2.document_class, dict)
    opts3 = opts2.with_options(document_class=SON)
    self.assertEqual(opts3.uuid_representation, UuidRepresentation.JAVA_LEGACY)
    self.assertEqual(opts3.document_class, SON)
def test_json_options_with_options(self):
    opts = json_util.JSONOptions(datetime_representation=DatetimeRepresentation.NUMBERLONG)
    self.assertEqual(opts.datetime_representation, DatetimeRepresentation.NUMBERLONG)
    opts2 = opts.with_options(datetime_representation=DatetimeRepresentation.ISO8601)
    self.assertEqual(opts2.datetime_representation, DatetimeRepresentation.ISO8601)
    opts = json_util.JSONOptions(strict_number_long=True)
    self.assertEqual(opts.strict_number_long, True)
    opts2 = opts.with_options(strict_number_long=False)
    self.assertEqual(opts2.strict_number_long, False)
    opts = json_util.CANONICAL_JSON_OPTIONS
    self.assertNotEqual(opts.uuid_representation, UuidRepresentation.JAVA_LEGACY)
    opts2 = opts.with_options(uuid_representation=UuidRepresentation.JAVA_LEGACY)
    self.assertEqual(opts2.uuid_representation, UuidRepresentation.JAVA_LEGACY)
    self.assertEqual(opts2.document_class, dict)
    opts3 = opts2.with_options(document_class=SON)
    self.assertEqual(opts3.uuid_representation, UuidRepresentation.JAVA_LEGACY)
    self.assertEqual(opts3.document_class, SON)