Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return info of reper function is wrong in api.py #1032

Merged
merged 1 commit into from Dec 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions nbgrader/api.py
Expand Up @@ -275,7 +275,8 @@ def to_dict(self):
}

def __repr__(self):
return "{}/{}".format(self.notebook, self.name)
return "SolutionCell<{}/{}/{}>".format(
self.assignment.name, self.notebook.name, self.name)


class SourceCell(Base):
Expand Down Expand Up @@ -332,7 +333,7 @@ def to_dict(self):
}

def __repr__(self):
return "SolutionCell<{}/{}/{}>".format(
return "SourceCell<{}/{}/{}>".format(
self.assignment.name, self.notebook.name, self.name)


Expand Down
4 changes: 3 additions & 1 deletion nbgrader/tests/api/test_models.py
Expand Up @@ -146,6 +146,8 @@ def test_create_solution_cell(db):
assert s.comments == []
assert n.solution_cells == [s]

assert repr(s) == "SolutionCell<foo/blah/foo>"


def test_create_source_cell(db):
now = datetime.datetime.utcnow()
Expand All @@ -167,7 +169,7 @@ def test_create_source_cell(db):
assert s.notebook == n
assert n.source_cells == [s]

assert repr(s) == "SolutionCell<foo/blah/foo>"
assert repr(s) == "SourceCell<foo/blah/foo>"


def test_create_student(db):
Expand Down