Skip to content

Commit 661533f

Browse files
Remove deprecated features in tests.
1 parent 35e0fd3 commit 661533f

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

tests/schema_advanced.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Parent(dj.Manual):
4545
-> Person
4646
parent_sex : enum('M','F')
4747
---
48-
(parent) -> Person
48+
-> Person.proj(parent='person_id')
4949
"""
5050

5151
def fill(self):
@@ -132,8 +132,8 @@ class InputCell(dj.Manual):
132132
@schema
133133
class LocalSynapse(dj.Manual):
134134
definition = """ # a synapse within the slice
135-
(presynaptic) -> Cell(cell)
136-
(postsynaptic)-> Cell
135+
-> Cell.proj(presynaptic='cell')
136+
-> Cell.proj(postsynaptic='cell')
137137
"""
138138

139139

@@ -143,5 +143,5 @@ class GlobalSynapse(dj.Manual):
143143
definition = """
144144
# a synapse within the slice
145145
-> Cell.proj(pre_slice="slice", pre_cell="cell")
146-
(post_slice, post_cell)-> Cell(slice, cell)
146+
-> Cell.proj(post_slice="slice", post_cell="cell")
147147
"""

tests/test_relational_operand.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)