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 token exception error #25

Merged
merged 1 commit into from
Oct 10, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions picas/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,16 @@ def error(self, msg=None, exception=None):
if exception is not None:
error['exception'] = traceback.format_exc()

self.doc['lock'] = -1
self.doc['done'] = -1
self.doc['lock'] = 99
self.doc['done'] = 99
if 'error' not in self.doc:
self.doc['error'] = []
self.doc['error'].append(error)
return self

def has_error(self):
"""Bool: check if document has an error"""
return self.doc['lock'] == -1
return self.doc['lock'] == 99

def get_errors(self):
"""Get document error"""
Expand Down
4 changes: 2 additions & 2 deletions picas/modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ def scrub(self, token):
return token

def set_error(self, token):
token['lock'] = -1
token['done'] = -1
token['lock'] = 99
token['done'] = 99
return token


Expand Down
4 changes: 2 additions & 2 deletions tests/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def test_scrub(self):

def test_error(self):
self.task.error("some message")
self.assertEqual(self.task['lock'], -1)
self.assertEqual(self.task['done'], -1)
self.assertEqual(self.task['lock'], 99)
self.assertEqual(self.task['done'], 99)
self.task.scrub()
self.assertEqual(self.task['lock'], 0)
self.assertEqual(self.task['done'], 0)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def test_scrub(self):

def test_seterror(self):
self.modifier.set_error(self.token)
self.assertTrue(self.token['lock'] == -1)
self.assertTrue(self.token['done'] == -1)
self.assertTrue(self.token['lock'] == 99)
self.assertTrue(self.token['done'] == 99)

def test_addoutput(self):
self.modifier.add_output(self.token, {"output": "test"})
Expand Down