@@ -504,14 +504,14 @@ def test_date():
504504 F .insert1 ((2 , "2019-09-25" ))
505505
506506 new_value = None
507- ( F & "id=2" )._update ( "date" , new_value )
507+ F . update1 ( dict (( F & "id=2" ).proj (). fetch1 (), date = new_value ) )
508508 assert_equal ((F & "id=2" ).fetch1 ("date" ), new_value )
509509
510510 new_value = datetime .date (2019 , 10 , 25 )
511- ( F & "id=2" )._update ( "date" , new_value )
511+ F . update1 ( dict (( F & "id=2" ).proj (). fetch1 (), date = new_value ) )
512512 assert_equal ((F & "id=2" ).fetch1 ("date" ), new_value )
513513
514- ( F & "id=2" )._update ( " date" )
514+ F . update1 ( dict (( F & "id=2" ).proj (). fetch1 (), date = None ) )
515515 assert_equal ((F & "id=2" ).fetch1 ("date" ), None )
516516
517517 @staticmethod
@@ -532,19 +532,21 @@ def test_ellipsis():
532532 @raises (dj .DataJointError )
533533 def test_update_single_key ():
534534 """Test that only one row can be updated"""
535- TTestUpdate ()._update ("string_attr" , "my new string" )
535+ TTestUpdate .update1 (
536+ dict (TTestUpdate .proj ().fetch1 (), string_attr = "my new string" )
537+ )
536538
537539 @staticmethod
538540 @raises (dj .DataJointError )
539541 def test_update_no_primary ():
540542 """Test that no primary key can be updated"""
541- TTestUpdate (). _update ( "primary_key" , 2 )
543+ TTestUpdate . update1 ( dict ( TTestUpdate . proj (). fetch1 (), primary_key = 2 ) )
542544
543545 @staticmethod
544546 @raises (dj .DataJointError )
545547 def test_update_missing_attribute ():
546548 """Test that attribute is in table"""
547- TTestUpdate (). _update ( "not_existing" , 2 )
549+ TTestUpdate . update1 ( dict ( TTestUpdate . proj (). fetch1 (), not_existing = 2 ) )
548550
549551 @staticmethod
550552 def test_update_string_attribute ():
@@ -553,25 +555,25 @@ def test_update_string_attribute():
553555 s = "" .join (
554556 random .choice (string .ascii_uppercase + string .digits ) for _ in range (10 )
555557 )
556- rel ._update ( "string_attr" , s )
558+ TTestUpdate . update1 ( dict ( rel .proj (). fetch1 (), string_attr = s ) )
557559 assert_equal (s , rel .fetch1 ("string_attr" ), "Updated string does not match" )
558560
559561 @staticmethod
560562 def test_update_numeric_attribute ():
561563 """Test replacing a string value"""
562564 rel = TTestUpdate () & dict (primary_key = 0 )
563565 s = random .randint (0 , 10 )
564- rel ._update ( "num_attr" , s )
566+ TTestUpdate . update1 ( dict ( rel .proj (). fetch1 (), num_attr = s ) )
565567 assert_equal (s , rel .fetch1 ("num_attr" ), "Updated integer does not match" )
566- rel ._update ( "num_attr" , None )
568+ TTestUpdate . update1 ( dict ( rel .proj (). fetch1 (), num_attr = None ) )
567569 assert_true (np .isnan (rel .fetch1 ("num_attr" )), "Numeric value is not NaN" )
568570
569571 @staticmethod
570572 def test_update_blob_attribute ():
571573 """Test replacing a string value"""
572574 rel = TTestUpdate () & dict (primary_key = 0 )
573575 s = rel .fetch1 ("blob_attr" )
574- rel ._update ( "blob_attr" , s .T )
576+ TTestUpdate . update1 ( dict ( rel .proj (). fetch1 (), blob_attr = s .T ) )
575577 assert_equal (
576578 s .T .shape , rel .fetch1 ("blob_attr" ).shape , "Array dimensions do not match"
577579 )
0 commit comments