Skip to content

Commit 4aa011e

Browse files
Fix #698
1 parent 134a254 commit 4aa011e

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

datajoint/table.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,9 @@ def heading(self):
4545
"""
4646
if self._heading is None:
4747
self._heading = Heading() # instance-level heading
48-
if not self._heading: # lazy loading of heading
49-
if self.connection is None:
50-
raise DataJointError(
51-
'DataJoint class is missing a database connection. '
52-
'Missing schema decorator on the class? (e.g. @schema)')
53-
else:
54-
self._heading.init_from_database(
55-
self.connection, self.database, self.table_name, self.declaration_context)
48+
if not self._heading and self.connection is not None: # lazy loading of heading
49+
self._heading.init_from_database(
50+
self.connection, self.database, self.table_name, self.declaration_context)
5651
return self._heading
5752

5853
def declare(self, context=None):

datajoint/user_tables.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# attributes that trigger instantiation of user classes
1414
supported_class_attrs = {
1515
'key_source', 'describe', 'alter', 'heading', 'populate', 'progress', 'primary_key', 'proj', 'aggr',
16-
'fetch', 'fetch1','head', 'tail',
16+
'fetch', 'fetch1', 'head', 'tail',
1717
'insert', 'insert1', 'drop', 'drop_quick', 'delete', 'delete_quick'}
1818

1919

@@ -92,7 +92,7 @@ def table_name(cls):
9292

9393
@ClassProperty
9494
def full_table_name(cls):
95-
if cls not in {Manual, Imported, Lookup, Computed, Part}:
95+
if cls not in {Manual, Imported, Lookup, Computed, Part, UserTable}:
9696
if cls.database is None:
9797
raise DataJointError('Class %s is not properly declared (schema decorator not applied?)' % cls.__name__)
9898
return r"`{0:s}`.`{1:s}`".format(cls.database, cls.table_name)

tests/schema.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
@schema
1515
class TTest(dj.Lookup):
16+
"""
17+
doc string
18+
"""
1619
definition = """
1720
key : int # key
1821
---

tests/test_relation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ def setup_class(cls):
3636
cls.img = schema.Image()
3737
cls.trash = schema.UberTrash()
3838

39+
def test_class_help(self):
40+
help(schema.TTest)
41+
42+
def test_instance_help(self):
43+
help(schema.TTest())
44+
3945
def test_contents(self):
4046
"""
4147
test the ability of tables to self-populate using the contents property

0 commit comments

Comments
 (0)