<s> from unittest . mock import patch <EOL> from orchestra . core . errors import IllegalTaskSubmission <EOL> from orchestra . core . errors import NoTaskAvailable <EOL> from orchestra . core . errors import AssignmentPolicyError <EOL> from orchestra . core . errors import ModelSaveError <EOL> from orchestra . core . errors import ReviewPolicyError <EOL> from orchestra . core . errors import TaskAssignmentError <EOL> from orchestra . core . errors import TaskStatusError <EOL> from orchestra . core . errors import WorkerCertificationError <EOL> from orchestra . models import Iteration <EOL> from orchestra . models import Project <EOL> from orchestra . models import Task <EOL> from orchestra . models import TaskAssignment <EOL> from orchestra . models import WorkerCertification <EOL> from orchestra . tests . helpers import OrchestraTestCase <EOL> from orchestra . tests . helpers . fixtures import setup_models <EOL> from orchestra . tests . helpers . fixtures import StepFactory <EOL> from orchestra . tests . helpers . fixtures import TaskAssignmentFactory <EOL> from orchestra . tests . helpers . fixtures import TaskFactory <EOL> from orchestra . utils . task_lifecycle import check_worker_allowed_new_assignment <EOL> from orchestra . utils . task_lifecycle import is_worker_certified_for_task <EOL> from orchestra . utils . task_lifecycle import assign_task <EOL> from orchestra . utils . task_lifecycle import create_subsequent_tasks <EOL> from orchestra . utils . task_lifecycle import get_new_task_assignment <EOL> from orchestra . utils . task_lifecycle import get_next_task_status <EOL> from orchestra . utils . task_lifecycle import get_task_overview_for_worker <EOL> from orchestra . utils . task_lifecycle import submit_task <EOL> from orchestra . utils . task_lifecycle import worker_assigned_to_rejected_task <EOL> from orchestra . utils . task_lifecycle import worker_has_reviewer_status <EOL> from orchestra . utils . task_properties import current_assignment <EOL> from orchestra . utils . task_properties import is_worker_assigned_to_task <EOL> class BasicTaskLifeCycleTestCase ( OrchestraTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> super ( ) . setUp ( ) <EOL> setup_models ( self ) <EOL> def test_is_worker_certified_for_task ( self ) : <EOL> task = Task . objects . filter ( status = Task . Status . AWAITING_PROCESSING ) [ <NUM_LIT:0> ] <EOL> self . assertTrue ( <EOL> is_worker_certified_for_task ( self . workers [ <NUM_LIT:0> ] , <EOL> task , <EOL> WorkerCertification . Role . ENTRY_LEVEL ) ) <EOL> self . assertFalse ( <EOL> is_worker_certified_for_task ( self . workers [ <NUM_LIT:2> ] , <EOL> task , <EOL> WorkerCertification . Role . ENTRY_LEVEL ) ) <EOL> def test_check_worker_allowed_new_assignment ( self ) : <EOL> invalid_statuses = [ Task . Status . PROCESSING , <EOL> Task . Status . REVIEWING , <EOL> Task . Status . POST_REVIEW_PROCESSING , <EOL> Task . Status . COMPLETE , <EOL> Task . Status . ABORTED ] <EOL> for status in invalid_statuses : <EOL> with self . assertRaises ( TaskStatusError ) : <EOL> check_worker_allowed_new_assignment ( self . workers [ <NUM_LIT:2> ] , status ) <EOL> def test_get_new_task_assignment_entry_level ( self ) : <EOL> self . assertEquals ( Task . objects <EOL> . filter ( status = Task . Status . AWAITING_PROCESSING ) <EOL> . count ( ) , <EOL> <NUM_LIT:1> ) <EOL> with self . assertRaises ( WorkerCertificationError ) : <EOL> get_new_task_assignment ( self . workers [ <NUM_LIT:5> ] , <EOL> Task . Status . PENDING_REVIEW ) <EOL> assignment = get_new_task_assignment ( self . workers [ <NUM_LIT:5> ] , <EOL> Task . Status . AWAITING_PROCESSING ) <EOL> self . assertTrue ( assignment is not None ) <EOL> self . assertEquals ( assignment . task . status , <EOL> Task . Status . PROCESSING ) <EOL> with self . assertRaises ( NoTaskAvailable ) : <EOL> get_new_task_assignment ( self . workers [ <NUM_LIT:5> ] , <EOL> Task . Status . AWAITING_PROCESSING ) <EOL> workflow_version = self . workflow_versions [ '<STR_LIT>' ] <EOL> simple_machine = self . workflow_steps [ <EOL> workflow_version . slug ] [ '<STR_LIT>' ] <EOL> project = Project . objects . create ( workflow_version = workflow_version , <EOL> short_description = '<STR_LIT>' , <EOL> priority = <NUM_LIT:0> , <EOL> task_class = <NUM_LIT:0> ) <EOL> Task . objects . create ( project = project , <EOL> status = Task . Status . AWAITING_PROCESSING , <EOL> step = simple_machine ) <EOL> with self . assertRaises ( NoTaskAvailable ) : <EOL> get_new_task_assignment ( self . workers [ <NUM_LIT:5> ] , <EOL> Task . Status . AWAITING_PROCESSING ) <EOL> def test_get_new_task_assignment_reviewer ( self ) : <EOL> self . assertEquals ( Task . objects <EOL> . filter ( status = Task . Status . PENDING_REVIEW ) <EOL> . count ( ) , <EOL> <NUM_LIT:1> ) <EOL> assignment = get_new_task_assignment ( self . workers [ <NUM_LIT:7> ] , <EOL> Task . Status . PENDING_REVIEW ) <EOL> self . assertTrue ( assignment is not None ) <EOL> self . assertEquals ( assignment . task . status , <EOL> Task . Status . REVIEWING ) <EOL> self . assertEquals ( assignment . in_progress_task_data , <EOL> { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> with self . assertRaises ( NoTaskAvailable ) : <EOL> get_new_task_assignment ( self . workers [ <NUM_LIT:7> ] , <EOL> Task . Status . PENDING_REVIEW ) <EOL> assignment = get_new_task_assignment ( self . workers [ <NUM_LIT:7> ] , <EOL> Task . Status . AWAITING_PROCESSING ) <EOL> with self . assertRaises ( NoTaskAvailable ) : <EOL> get_new_task_assignment ( self . workers [ <NUM_LIT:7> ] , <EOL> Task . Status . AWAITING_PROCESSING ) <EOL> def test_is_worker_assigned_to_task ( self ) : <EOL> task = self . tasks [ '<STR_LIT>' ] <EOL> self . assertFalse ( is_worker_assigned_to_task ( self . workers [ <NUM_LIT:2> ] , <EOL> task ) ) <EOL> self . assertTrue ( is_worker_assigned_to_task ( self . workers [ <NUM_LIT:0> ] , <EOL> task ) ) <EOL> def test_worker_assigned_to_max_tasks ( self ) : <EOL> pass <EOL> def test_worker_assigned_to_rejected_task ( self ) : <EOL> assignments = TaskAssignment . objects . filter ( <EOL> worker = self . workers [ <NUM_LIT:4> ] , <EOL> status = TaskAssignment . Status . PROCESSING , <EOL> task__status = Task . Status . POST_REVIEW_PROCESSING ) <EOL> self . assertTrue ( assignments . exists ( ) ) <EOL> self . assertTrue ( worker_assigned_to_rejected_task ( self . workers [ <NUM_LIT:4> ] ) ) <EOL> with self . assertRaises ( TaskAssignmentError ) : <EOL> get_new_task_assignment ( self . workers [ <NUM_LIT:4> ] , <EOL> Task . Status . AWAITING_PROCESSING ) <EOL> def test_worker_has_reviewer_status ( self ) : <EOL> self . assertFalse ( worker_has_reviewer_status ( self . workers [ <NUM_LIT:0> ] ) ) <EOL> self . assertTrue ( worker_has_reviewer_status ( self . workers [ <NUM_LIT:1> ] ) ) <EOL> self . assertFalse ( worker_has_reviewer_status ( self . workers [ <NUM_LIT:2> ] ) ) <EOL> self . assertFalse ( worker_has_reviewer_status ( self . workers [ <NUM_LIT:4> ] ) ) <EOL> self . assertTrue ( worker_has_reviewer_status ( self . workers [ <NUM_LIT:5> ] ) ) <EOL> self . assertTrue ( worker_has_reviewer_status ( self . workers [ <NUM_LIT:6> ] ) ) <EOL> def test_assign_task ( self ) : <EOL> entry_task = TaskFactory ( <EOL> project = self . projects [ '<STR_LIT>' ] , <EOL> status = Task . Status . AWAITING_PROCESSING , <EOL> step = self . test_step ) <EOL> self . assertEqual ( <EOL> Iteration . objects . filter ( assignment__task = entry_task ) . count ( ) , <NUM_LIT:0> ) <EOL> entry_task = assign_task ( self . workers [ <NUM_LIT:0> ] . id , entry_task . id ) <EOL> self . assertTrue ( is_worker_assigned_to_task ( self . workers [ <NUM_LIT:0> ] , <EOL> entry_task ) ) <EOL> self . assertEqual ( entry_task . status , Task . Status . PROCESSING ) <EOL> self . assertEqual ( entry_task . assignments . count ( ) , <NUM_LIT:1> ) <EOL> entry_assignment = entry_task . assignments . first ( ) <EOL> self . assertEqual ( entry_assignment . iterations . count ( ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( <EOL> Iteration . objects . filter ( assignment__task = entry_task ) . count ( ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( <EOL> entry_assignment . iterations . first ( ) . start_datetime , <EOL> entry_assignment . start_datetime ) <EOL> invalid = ( Task . Status . PROCESSING , Task . Status . ABORTED , <EOL> Task . Status . REVIEWING , Task . Status . COMPLETE , <EOL> Task . Status . POST_REVIEW_PROCESSING ) <EOL> for status in invalid : <EOL> invalid_status_task = Task . objects . create ( <EOL> project = self . projects [ '<STR_LIT>' ] , <EOL> status = status , <EOL> step = self . test_step ) <EOL> with self . assertRaises ( TaskAssignmentError ) : <EOL> invalid_status_task = assign_task ( <EOL> self . workers [ <NUM_LIT:0> ] . id , invalid_status_task . id ) <EOL> review_task = Task . objects . create ( <EOL> project = self . projects [ '<STR_LIT>' ] , <EOL> status = Task . Status . PENDING_REVIEW , <EOL> step = self . test_step ) <EOL> test_data = { '<STR_LIT>' : True } <EOL> TaskAssignmentFactory ( <EOL> worker = self . workers [ <NUM_LIT:1> ] , <EOL> task = review_task , <EOL> status = TaskAssignment . Status . SUBMITTED , <EOL> in_progress_task_data = test_data ) <EOL> with self . assertRaises ( TaskAssignmentError ) : <EOL> assign_task ( self . workers [ <NUM_LIT:1> ] . id , review_task . id ) <EOL> self . assertEqual ( <EOL> current_assignment ( review_task ) . in_progress_task_data , test_data ) <EOL> with self . assertRaises ( WorkerCertificationError ) : <EOL> assign_task ( self . workers [ <NUM_LIT:2> ] . id , review_task . id ) <EOL> self . assertEqual ( <EOL> current_assignment ( review_task ) . in_progress_task_data , test_data ) <EOL> self . assertEquals ( review_task . assignments . count ( ) , <NUM_LIT:1> ) <EOL> review_task = assign_task ( self . workers [ <NUM_LIT:3> ] . id , review_task . id ) <EOL> self . assertEquals ( review_task . assignments . count ( ) , <NUM_LIT:2> ) <EOL> reviewer_assignment = current_assignment ( review_task ) <EOL> self . assertEqual ( <EOL> reviewer_assignment . worker , self . workers [ <NUM_LIT:3> ] ) <EOL> self . assertEqual ( <EOL> reviewer_assignment . in_progress_task_data , test_data ) <EOL> self . assertEquals ( <EOL> reviewer_assignment . iterations . count ( ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( <EOL> reviewer_assignment . iterations . first ( ) . start_datetime , <EOL> reviewer_assignment . start_datetime ) <EOL> self . assertEquals ( <EOL> review_task . status , Task . Status . REVIEWING ) <EOL> def test_get_task_overview_for_worker ( self ) : <EOL> task = self . tasks [ '<STR_LIT>' ] <EOL> with self . assertRaises ( TaskAssignmentError ) : <EOL> get_task_overview_for_worker ( task . id , self . workers [ <NUM_LIT:2> ] ) <EOL> data = get_task_overview_for_worker ( task . id , self . workers [ <NUM_LIT:0> ] ) <EOL> expected = { <EOL> '<STR_LIT>' : { '<STR_LIT>' : task . project . short_description , <EOL> '<STR_LIT:id>' : task . project . id , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : None } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:name>' : '<STR_LIT>' } , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { '<STR_LIT:data>' : { '<STR_LIT>' : '<STR_LIT>' } , <EOL> '<STR_LIT:status>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' : task . id , <EOL> '<STR_LIT>' : task . assignments . get ( worker = self . workers [ <NUM_LIT:0> ] ) . id , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:username>' : self . workers [ <NUM_LIT:0> ] . user . username , <EOL> '<STR_LIT>' : self . workers [ <NUM_LIT:0> ] . user . first_name , <EOL> '<STR_LIT>' : self . workers [ <NUM_LIT:0> ] . user . last_name , <EOL> } <EOL> } <EOL> self . assertEquals ( data , expected ) <EOL> def test_task_assignment_saving ( self ) : <EOL> """<STR_LIT>""" <EOL> workflow_version = self . workflow_versions [ '<STR_LIT>' ] <EOL> simple_machine = self . workflow_steps [ <EOL> workflow_version . slug ] [ '<STR_LIT>' ] <EOL> project = Project . objects . create ( workflow_version = workflow_version , <EOL> short_description = '<STR_LIT>' , <EOL> priority = <NUM_LIT:0> , <EOL> task_class = <NUM_LIT:0> ) <EOL> task = Task . objects . create ( project = project , <EOL> status = Task . Status . PROCESSING , <EOL> step = simple_machine ) <EOL> with self . assertRaises ( ModelSaveError ) : <EOL> TaskAssignment . objects . create ( worker = self . workers [ <NUM_LIT:0> ] , <EOL> task = task , <EOL> status = <NUM_LIT:0> , <EOL> in_progress_task_data = { } ) <EOL> human_step = self . workflow_steps [ workflow_version . slug ] [ '<STR_LIT>' ] <EOL> task = Task . objects . create ( project = project , <EOL> status = Task . Status . PROCESSING , <EOL> step = human_step ) <EOL> with self . assertRaises ( ModelSaveError ) : <EOL> TaskAssignment . objects . create ( task = task , <EOL> status = <NUM_LIT:0> , <EOL> in_progress_task_data = { } ) <EOL> def test_illegal_get_next_task_status ( self ) : <EOL> task = self . tasks [ '<STR_LIT>' ] <EOL> illegal_statuses = [ <EOL> Task . Status . AWAITING_PROCESSING , <EOL> Task . Status . PENDING_REVIEW , <EOL> Task . Status . COMPLETE <EOL> ] <EOL> iteration_statuses = [ <EOL> Iteration . Status . REQUESTED_REVIEW , <EOL> Iteration . Status . PROVIDED_REVIEW <EOL> ] <EOL> for status in illegal_statuses : <EOL> for iteration_status in iteration_statuses : <EOL> with self . assertRaises ( IllegalTaskSubmission ) : <EOL> task . status = status <EOL> get_next_task_status ( task , iteration_status ) <EOL> with self . assertRaises ( IllegalTaskSubmission ) : <EOL> task . status = Task . Status . PROCESSING <EOL> get_next_task_status ( task , Iteration . Status . PROVIDED_REVIEW ) <EOL> with self . assertRaises ( IllegalTaskSubmission ) : <EOL> task . status = Task . Status . POST_REVIEW_PROCESSING <EOL> get_next_task_status ( task , Iteration . Status . PROVIDED_REVIEW ) <EOL> def test_sampled_get_next_task_status ( self ) : <EOL> task = self . tasks [ '<STR_LIT>' ] <EOL> step = task . step <EOL> step . review_policy = { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:0.5> , <EOL> '<STR_LIT>' : <NUM_LIT:1> } <EOL> step . save ( ) <EOL> task . status = Task . Status . PROCESSING <EOL> complete_count = <NUM_LIT:0> <EOL> for i in range ( <NUM_LIT:0> , <NUM_LIT:1000> ) : <EOL> next_status = get_next_task_status ( <EOL> task , Iteration . Status . REQUESTED_REVIEW ) <EOL> complete_count += next_status == Task . Status . COMPLETE <EOL> self . assertTrue ( complete_count > <NUM_LIT> ) <EOL> self . assertTrue ( complete_count < <NUM_LIT> ) <EOL> def test_legal_get_next_task_status ( self ) : <EOL> task = self . tasks [ '<STR_LIT>' ] <EOL> step = task . step <EOL> task . status = Task . Status . PROCESSING <EOL> step . review_policy = { } <EOL> step . save ( ) <EOL> with self . assertRaises ( ReviewPolicyError ) : <EOL> get_next_task_status ( task , <EOL> Iteration . Status . REQUESTED_REVIEW ) <EOL> step . review_policy = { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:1> } <EOL> step . save ( ) <EOL> self . assertEquals ( <EOL> get_next_task_status ( task , <EOL> Iteration . Status . REQUESTED_REVIEW ) , <EOL> Task . Status . PENDING_REVIEW ) <EOL> step . review_policy = { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : <NUM_LIT:1> } <EOL> step . save ( ) <EOL> self . assertEquals ( <EOL> get_next_task_status ( task , <EOL> Iteration . Status . REQUESTED_REVIEW ) , <EOL> Task . Status . COMPLETE ) <EOL> task . status = Task . Status . POST_REVIEW_PROCESSING <EOL> self . assertEquals ( <EOL> get_next_task_status ( task , <EOL> Iteration . Status . REQUESTED_REVIEW ) , <EOL> Task . Status . REVIEWING ) <EOL> task = self . tasks [ '<STR_LIT>' ] <EOL> task . status = Task . Status . REVIEWING <EOL> step . review_policy = { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:0> } <EOL> step . save ( ) <EOL> self . assertEquals ( <EOL> get_next_task_status ( task , <EOL> Iteration . Status . REQUESTED_REVIEW ) , <EOL> Task . Status . COMPLETE ) <EOL> step . review_policy = { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:2> } <EOL> step . save ( ) <EOL> self . assertEquals ( <EOL> get_next_task_status ( task , <EOL> Iteration . Status . REQUESTED_REVIEW ) , <EOL> Task . Status . PENDING_REVIEW ) <EOL> TaskAssignment . objects . create ( <EOL> worker = self . workers [ <NUM_LIT:1> ] , <EOL> task = task , <EOL> status = TaskAssignment . Status . SUBMITTED , <EOL> assignment_counter = <NUM_LIT:1> , <EOL> in_progress_task_data = { } ) <EOL> task . save ( ) <EOL> step . review_policy = { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:1> } <EOL> step . save ( ) <EOL> self . assertEquals ( <EOL> get_next_task_status ( task , <EOL> Iteration . Status . REQUESTED_REVIEW ) , <EOL> Task . Status . COMPLETE ) <EOL> def test_preassign_workers ( self ) : <EOL> project = self . projects [ '<STR_LIT>' ] <EOL> create_subsequent_tasks ( project ) <EOL> self . assertEquals ( project . tasks . count ( ) , <NUM_LIT:1> ) <EOL> initial_task = assign_task ( self . workers [ <NUM_LIT:0> ] . id , <EOL> project . tasks . first ( ) . id ) <EOL> with patch ( '<STR_LIT>' , <EOL> return_value = False ) : <EOL> initial_task = submit_task ( initial_task . id , { } , <EOL> Iteration . Status . REQUESTED_REVIEW , <EOL> self . workers [ <NUM_LIT:0> ] ) <EOL> self . assertEquals ( project . tasks . count ( ) , <NUM_LIT:2> ) <EOL> related_task = project . tasks . exclude ( id = initial_task . id ) . first ( ) <EOL> self . assertEquals ( related_task . assignments . count ( ) , <NUM_LIT:0> ) <EOL> self . assertEquals ( related_task . status , Task . Status . AWAITING_PROCESSING ) <EOL> project . tasks . all ( ) . delete ( ) <EOL> create_subsequent_tasks ( project ) <EOL> self . assertEquals ( project . tasks . count ( ) , <NUM_LIT:1> ) <EOL> initial_task = assign_task ( self . workers [ <NUM_LIT:4> ] . id , <EOL> project . tasks . first ( ) . id ) <EOL> with patch ( '<STR_LIT>' , <EOL> return_value = False ) : <EOL> initial_task = submit_task ( initial_task . id , { } , <EOL> Iteration . Status . REQUESTED_REVIEW , <EOL> self . workers [ <NUM_LIT:4> ] ) <EOL> self . assertEquals ( project . tasks . count ( ) , <NUM_LIT:2> ) <EOL> related_task = project . tasks . exclude ( id = initial_task . id ) . first ( ) <EOL> self . assertEquals ( related_task . assignments . count ( ) , <NUM_LIT:1> ) <EOL> self . assertEquals ( related_task . status , Task . Status . PROCESSING ) <EOL> self . assertTrue ( is_worker_assigned_to_task ( self . workers [ <NUM_LIT:4> ] , <EOL> related_task ) ) <EOL> project . tasks . all ( ) . delete ( ) <EOL> def test_malformed_assignment_policy ( self ) : <EOL> project = self . projects [ '<STR_LIT>' ] <EOL> workflow_version = project . workflow_version <EOL> first_step = self . workflow_steps [ workflow_version . slug ] [ '<STR_LIT>' ] <EOL> malformed_step = StepFactory ( <EOL> workflow_version = workflow_version , <EOL> slug = '<STR_LIT>' , <EOL> is_human = False , <EOL> assignment_policy = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] <EOL> } , <EOL> ) <EOL> malformed_step . creation_depends_on . add ( first_step ) <EOL> create_subsequent_tasks ( project ) <EOL> self . assertEquals ( project . tasks . count ( ) , <NUM_LIT:1> ) <EOL> initial_task = assign_task ( self . workers [ <NUM_LIT:4> ] . id , <EOL> project . tasks . first ( ) . id ) <EOL> initial_task . status = Task . Status . COMPLETE <EOL> initial_task . save ( ) <EOL> with self . assertRaises ( AssignmentPolicyError ) : <EOL> create_subsequent_tasks ( project ) <EOL> project . tasks . all ( ) . delete ( ) <EOL> first_step . assignment_policy = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] <EOL> } <EOL> first_step . save ( ) <EOL> with self . assertRaises ( AssignmentPolicyError ) : <EOL> create_subsequent_tasks ( project ) <EOL> first_step . assignment_policy = { } <EOL> first_step . save ( ) <EOL> project . tasks . all ( ) . delete ( ) </s>
