@@ -504,14 +504,14 @@ def test_date():
504
504
F .insert1 ((2 , "2019-09-25" ))
505
505
506
506
new_value = None
507
- F .update1 (dict ((F & "id=2" ).proj (). fetch1 (), date = new_value ))
507
+ F .update1 (dict ((F & "id=2" ).fetch1 ("KEY" ), date = new_value ))
508
508
assert_equal ((F & "id=2" ).fetch1 ("date" ), new_value )
509
509
510
510
new_value = datetime .date (2019 , 10 , 25 )
511
- F .update1 (dict ((F & "id=2" ).proj (). fetch1 (), date = new_value ))
511
+ F .update1 (dict ((F & "id=2" ).fetch1 ("KEY" ), date = new_value ))
512
512
assert_equal ((F & "id=2" ).fetch1 ("date" ), new_value )
513
513
514
- F .update1 (dict ((F & "id=2" ).proj (). fetch1 (), date = None ))
514
+ F .update1 (dict ((F & "id=2" ).fetch1 ("KEY" ), date = None ))
515
515
assert_equal ((F & "id=2" ).fetch1 ("date" ), None )
516
516
517
517
@staticmethod
@@ -533,20 +533,20 @@ def test_ellipsis():
533
533
def test_update_single_key ():
534
534
"""Test that only one row can be updated"""
535
535
TTestUpdate .update1 (
536
- dict (TTestUpdate .proj (). fetch1 (), string_attr = "my new string" )
536
+ dict (TTestUpdate .fetch1 ("KEY" ), string_attr = "my new string" )
537
537
)
538
538
539
539
@staticmethod
540
540
@raises (dj .DataJointError )
541
541
def test_update_no_primary ():
542
542
"""Test that no primary key can be updated"""
543
- TTestUpdate .update1 (dict (TTestUpdate .proj (). fetch1 (), primary_key = 2 ))
543
+ TTestUpdate .update1 (dict (TTestUpdate .fetch1 ("KEY" ), primary_key = 2 ))
544
544
545
545
@staticmethod
546
546
@raises (dj .DataJointError )
547
547
def test_update_missing_attribute ():
548
548
"""Test that attribute is in table"""
549
- TTestUpdate .update1 (dict (TTestUpdate .proj (). fetch1 (), not_existing = 2 ))
549
+ TTestUpdate .update1 (dict (TTestUpdate .fetch1 ("KEY" ), not_existing = 2 ))
550
550
551
551
@staticmethod
552
552
def test_update_string_attribute ():
@@ -555,25 +555,25 @@ def test_update_string_attribute():
555
555
s = "" .join (
556
556
random .choice (string .ascii_uppercase + string .digits ) for _ in range (10 )
557
557
)
558
- TTestUpdate .update1 (dict (rel .proj (). fetch1 (), string_attr = s ))
558
+ TTestUpdate .update1 (dict (rel .fetch1 ("KEY" ), string_attr = s ))
559
559
assert_equal (s , rel .fetch1 ("string_attr" ), "Updated string does not match" )
560
560
561
561
@staticmethod
562
562
def test_update_numeric_attribute ():
563
563
"""Test replacing a string value"""
564
564
rel = TTestUpdate () & dict (primary_key = 0 )
565
565
s = random .randint (0 , 10 )
566
- TTestUpdate .update1 (dict (rel .proj (). fetch1 (), num_attr = s ))
566
+ TTestUpdate .update1 (dict (rel .fetch1 ("KEY" ), num_attr = s ))
567
567
assert_equal (s , rel .fetch1 ("num_attr" ), "Updated integer does not match" )
568
- TTestUpdate .update1 (dict (rel .proj (). fetch1 (), num_attr = None ))
568
+ TTestUpdate .update1 (dict (rel .fetch1 ("KEY" ), num_attr = None ))
569
569
assert_true (np .isnan (rel .fetch1 ("num_attr" )), "Numeric value is not NaN" )
570
570
571
571
@staticmethod
572
572
def test_update_blob_attribute ():
573
573
"""Test replacing a string value"""
574
574
rel = TTestUpdate () & dict (primary_key = 0 )
575
575
s = rel .fetch1 ("blob_attr" )
576
- TTestUpdate .update1 (dict (rel .proj (). fetch1 (), blob_attr = s .T ))
576
+ TTestUpdate .update1 (dict (rel .fetch1 ("KEY" ), blob_attr = s .T ))
577
577
assert_equal (
578
578
s .T .shape , rel .fetch1 ("blob_attr" ).shape , "Array dimensions do not match"
579
579
)
0 commit comments