Skip to content

Commit ec7b2e0

Browse files
Add test to see if dependencies properly loaded on populate.
1 parent 9ef06f9 commit ec7b2e0

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

tests/test_autopopulate.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from nose.tools import assert_equal, assert_false, assert_true, raises
2-
from . import schema
2+
from . import schema, PREFIX
33
from datajoint import DataJointError
4+
import datajoint as dj
45

56

67
class TestPopulate:
@@ -64,3 +65,37 @@ def test_allow_insert(self):
6465
key['experiment_id'] = 1001
6566
key['experiment_date'] = '2018-10-30'
6667
self.experiment.insert1(key)
68+
69+
def test_load_dependencies(self):
70+
schema = dj.Schema(f'{PREFIX}_load_dependencies_populate')
71+
72+
@schema
73+
class ImageSource(dj.Lookup):
74+
definition = """
75+
image_source_id: int
76+
"""
77+
contents = [(0,)]
78+
79+
@schema
80+
class Image(dj.Imported):
81+
definition = """
82+
-> ImageSource
83+
---
84+
image_data: longblob
85+
"""
86+
87+
def make(self, key):
88+
self.insert1(dict(key, image_data=dict()))
89+
Image.populate()
90+
91+
@schema
92+
class Crop(dj.Computed):
93+
definition = """
94+
-> Image
95+
---
96+
crop_image: longblob
97+
"""
98+
99+
def make(self, key):
100+
self.insert1(dict(key, crop_image=dict()))
101+
Crop.populate()

0 commit comments

Comments
 (0)