@@ -155,7 +155,7 @@ def test_insert_cheuk_again(docker_url, test_schema):
155
155
uk .name = "United Kingdom of Great Britain and Northern Ireland"
156
156
assert (
157
157
str (error .value )
158
- == "name has been used to generated id hance cannot be changed."
158
+ == "name has been used to generate the id, hence cannot be changed."
159
159
)
160
160
161
161
cheuk = Employee ()
@@ -302,3 +302,37 @@ def test_compress_data(docker_url):
302
302
client .insert_document (test_obj , compress = 0 )
303
303
test_obj2 = client .get_all_documents (as_list = True )
304
304
assert len (test_obj2 ) == 10
305
+
306
+
307
+ def test_repeated_object_load (docker_url , test_schema ):
308
+ schema = test_schema
309
+ client = Client (docker_url , user_agent = test_user_agent )
310
+ client .connect ()
311
+ client .create_database ("test_repeated_load" )
312
+ client .insert_document (
313
+ schema , commit_msg = "I am checking in the schema" , graph_type = "schema"
314
+ )
315
+ [country_id ] = client .insert_document ({"@type" : "Country" ,
316
+ "name" : "Romania" ,
317
+ "perimeter" : []})
318
+ obj = client .get_document (country_id )
319
+ schema .import_objects (obj )
320
+ obj2 = client .get_document (country_id )
321
+ schema .import_objects (obj2 )
322
+
323
+
324
+ def test_key_change_raises_exception (docker_url , test_schema ):
325
+ schema = test_schema
326
+ client = Client (docker_url , user_agent = test_user_agent )
327
+ client .connect ()
328
+ client .create_database ("test_repeated_load_fails" )
329
+ client .insert_document (
330
+ schema , commit_msg = "I am checking in the schema" , graph_type = "schema"
331
+ )
332
+ [country_id ] = client .insert_document ({"@type" : "Country" ,
333
+ "name" : "Romania" ,
334
+ "perimeter" : []})
335
+ obj = client .get_document (country_id )
336
+ local_obj = schema .import_objects (obj )
337
+ with pytest .raises (ValueError , match = r"name has been used to generate the id, hence cannot be changed." ):
338
+ local_obj .name = "France"
0 commit comments