'''@author: srodrig1

PyCOMPSs Delete Object test
=========================
    This file represents PyCOMPSs Testbench.
    Checks the delete object functionality.
'''
import unittest
from pycompss.api.api import compss_wait_on, compss_delete_object
from tasks import increment_object

class testDeleteObject(unittest.TestCase):

    def testDeleteObject1(self):
        from pycompss.runtime.binding import pending_to_synchronize, objid_to_filename, get_object_id
        obj_1 = [0]
        obj_2 = increment_object(obj_1)
        obj_2 = compss_wait_on(obj_2)
        obj_1_id = get_object_id(obj_1, False, False)
        deletion_result = compss_delete_object(obj_1)
        self.assertTrue(deletion_result)
        self.assertFalse(obj_1_id in pending_to_synchronize)
        self.assertTrue(get_object_id(obj_1, False, False) is None)

    def testDeleteObject2(self):
        obj_1 = [0]
        for i in range(10):
            obj_1[0] = i-1
            obj_2    = increment_object(obj_1)
            obj_2    = compss_wait_on(obj_2)
            compss_delete_object(obj_1)
            self.assertEqual(i, obj_2[0])

@@ -1118,8 +1118,366 @@
 j_2%5B0%5D)%0A
+%0A    def testDeleteObject3(self):%0A        obj_1 = %5B0%5D%0A        obj_list = %5B%5D%0A        for i in range(10):%0A            obj_1%5B0%5D = i-1%0A            obj_2    = increment_object(obj_1)%0A            obj_list.append(obj_2)%0A            compss_delete_object(obj_1)%0A        obj_list = compss_wait_on(obj_list)%0A        self.assertEqual(%5B%5Bi%5D for i in range(10)%5D, obj_list)%0A

add test to delete object