Skip to content

Commit

Permalink
rm deprecated status field from Evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
jkiang13 committed Apr 29, 2021
1 parent 4e1aa16 commit e56dca9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
3 changes: 0 additions & 3 deletions synapseclient/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ def getURI(cls, id):
return '/evaluation/%s' % id

def __init__(self, **kwargs):
kwargs['status'] = kwargs.get('status', 'OPEN')
kwargs['contentSource'] = kwargs.get('contentSource', '')
if kwargs['status'] not in ['OPEN', 'PLANNED', 'CLOSED', 'COMPLETED']:
raise ValueError('Evaluation Status must be one of [OPEN, PLANNED, CLOSED, COMPLETED]')
if not kwargs['contentSource'].startswith('syn'): # Verify that synapse Id given
raise ValueError('The "contentSource" parameter must be specified as a Synapse Entity when creating an'
' Evaluation')
Expand Down
10 changes: 1 addition & 9 deletions tests/integration/synapseclient/test_evaluations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_evaluations(syn, project, schedule_for_cleanup):
# Create an Evaluation
name = 'Test Evaluation %s' % str(uuid.uuid4())
ev = Evaluation(name=name, description='Evaluation for testing',
contentSource=project['id'], status='CLOSED')
contentSource=project['id'])
ev = syn.store(ev)

try:
Expand All @@ -29,7 +29,6 @@ def test_evaluations(syn, project, schedule_for_cleanup):
assert ev['id'] == evalNamed['id']
assert ev['name'] == evalNamed['name']
assert ev['ownerId'] == evalNamed['ownerId']
assert ev['status'] == evalNamed['status']

# -- Get the Evaluation by project
evalProj = syn.getEvaluationByContentSource(project)
Expand All @@ -41,13 +40,6 @@ def test_evaluations(syn, project, schedule_for_cleanup):
assert ev['id'] == evalProj['id']
assert ev['name'] == evalProj['name']
assert ev['ownerId'] == evalProj['ownerId']
assert ev['status'] == evalProj['status']

# Update the Evaluation
ev['status'] = 'OPEN'
ev = syn.store(ev, createOrUpdate=True)
schedule_for_cleanup(ev)
assert ev.status == 'OPEN'

# Add the current user as a participant
myOwnerId = int(syn.getUserProfile()['ownerId'])
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/synapseclient/unit_test_Evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
def test_Evaluation():
"""Test the construction and accessors of Evaluation objects."""

# Status can only be one of ['OPEN', 'PLANNED', 'CLOSED', 'COMPLETED']
pytest.raises(ValueError, Evaluation, name='foo', description='bar', status='BAH')
pytest.raises(ValueError, Evaluation, name='foo', description='bar', status='OPEN', contentSource='a')
# contentSource must be specified and must be a synapse id
pytest.raises(ValueError, Evaluation, name='foo', description='bar')
pytest.raises(ValueError, Evaluation, name='foo', description='bar', contentSource='a')

# Assert that the values are
ev = Evaluation(name='foobar2', description='bar', status='OPEN', contentSource='syn1234')
Expand Down

0 comments on commit e56dca9

Please sign in to comment.