<commit_before>#!/usr/bin/python

# -*- coding: utf-8 -*-

"""
PyCOMPSs Inheritance Testbench
==============================
"""

# Imports
import unittest

from pycompss.api.api import compss_wait_on

class testInheritance(unittest.TestCase):

    '''
    INHERITANCE WITHIN THE SAME FILE
    '''

    def testSimpleInheritance_non_modifier(self):
        from .myclass import inheritedClass
        obj = inheritedClass()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235)

    def testSimpleInheritance_modifier(self):
        from .myclass import inheritedClass
        obj = inheritedClass()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235)

    def testInheritance_with_overriding_non_modifier(self):
        from .myclass import inheritedClassWithOverride
        obj = inheritedClassWithOverride()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235 * 2)

    def testInheritance_with_overriding_modifier(self):
        from .myclass import inheritedClassWithOverride
        obj = inheritedClassWithOverride()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235 * 2)

    def testInheritance_extended_non_modifier(self):
        from .myclass import inheritedClassExtended
        obj = inheritedClassExtended()
        o = obj.multiplier_non_modifier(4)
        o = compss_wait_on(o)
        self.assertEqual(o, 1234 * 4)

    def testInheritance_extended_modifier(self):
        from .myclass import inheritedClassExtended
        obj = inheritedClassExtended()
        obj.multiplier_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1234 * 4)

    def testInheritance_multilevel_non_modifier(self):
        from .myclass import inheritedClassMultilevelOverridedExtended
        obj = inheritedClassMultilevelOverridedExtended()
        o = obj.increment_non_modifier(4)
        o = compss_wait_on(o)
        p = obj.divider_non_modifier(4)
        p = compss_wait_on(p)
        self.assertEqual(o, 2 * (1234 + 4))
        self.assertEqual(p, 1234 / 4)

    def testInheritance_multilevel_modifier(self):
        from .myclass import inheritedClassMultilevelOverridedExtended
        obj = inheritedClassMultilevelOverridedExtended()
        obj.increment_modifier(4)
        obj.divider_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 2 * (1234 + 4) / 4)

    '''
    INHERITANCE FROM A DIFFERENT FILE WITH SAME CLASS NAME
    '''

    def testSimpleInheritance_non_modifier_othermodule(self):
        from .otherclasses_same_name import inheritedClass
        obj = inheritedClass()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235)

    def testSimpleInheritance_modifier_othermodule(self):
        from .otherclasses_same_name import inheritedClass
        obj = inheritedClass()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235)

    def testInheritance_with_overriding_non_modifier_othermodule(self):
        from .otherclasses_same_name import inheritedClassWithOverride
        obj = inheritedClassWithOverride()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235 * 2)

    def testInheritance_with_overriding_modifier_othermodule(self):
        from .otherclasses_same_name import inheritedClassWithOverride
        obj = inheritedClassWithOverride()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235 * 2)

    def testInheritance_extended_non_modifier_othermodule(self):
        from .otherclasses_same_name import inheritedClassExtended
        obj = inheritedClassExtended()
        o = obj.multiplier_non_modifier(4)
        o = compss_wait_on(o)
        self.assertEqual(o, 1234 * 4)

    def testInheritance_extended_modifier_othermodule(self):
        from .otherclasses_same_name import inheritedClassExtended
        obj = inheritedClassExtended()
        obj.multiplier_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1234 * 4)

    def testInheritance_multilevel_non_modifier_othermodule(self):
        from .otherclasses_same_name import inheritedClassMultilevelOverridedExtended
        obj = inheritedClassMultilevelOverridedExtended()
        o = obj.increment_non_modifier(4)
        o = compss_wait_on(o)
        p = obj.divider_non_modifier(4)
        p = compss_wait_on(p)
        self.assertEqual(o, 2 * (1234 + 4))
        self.assertEqual(p, 1234 / 4)

    def testInheritance_multilevel_modifier_othermodule(self):
        from .otherclasses_same_name import inheritedClassMultilevelOverridedExtended
        obj = inheritedClassMultilevelOverridedExtended()
        obj.increment_modifier(4)
        obj.divider_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 2 * (1234 + 4) / 4)

    '''
    INHERITANCE FROM A DIFFERENT FILE WITH SAME CLASS NAME
    '''

    def testSimpleInheritance_non_modifier_othermodule2(self):
        from .otherclasses_diff_name import inheritedClass2
        obj = inheritedClass2()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235)

    def testSimpleInheritance_modifier_othermodule2(self):
        from .otherclasses_diff_name import inheritedClass2
        obj = inheritedClass2()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235)

    def testInheritance_with_overriding_non_modifier_othermodule2(self):
        from .otherclasses_diff_name import inheritedClassWithOverride2
        obj = inheritedClassWithOverride2()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235 * 2)

    def testInheritance_with_overriding_modifier_othermodule2(self):
        from .otherclasses_diff_name import inheritedClassWithOverride2
        obj = inheritedClassWithOverride2()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235 * 2)

    def testInheritance_extended_non_modifier_othermodule2(self):
        from .otherclasses_diff_name import inheritedClassExtended2
        obj = inheritedClassExtended2()
        o = obj.multiplier_non_modifier(4)
        o = compss_wait_on(o)
        self.assertEqual(o, 1234 * 4)

    def testInheritance_extended_modifier_othermodule2(self):
        from .otherclasses_diff_name import inheritedClassExtended2
        obj = inheritedClassExtended2()
        obj.multiplier_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1234 * 4)

    def testInheritance_multilevel_non_modifier_othermodule2(self):
        from .otherclasses_diff_name import inheritedClassMultilevelOverridedExtended2
        obj = inheritedClassMultilevelOverridedExtended2()
        o = obj.increment_non_modifier(4)
        o = compss_wait_on(o)
        p = obj.divider_non_modifier(4)
        p = compss_wait_on(p)
        self.assertEqual(o, 2 * (1234 + 4))
        self.assertEqual(p, 1234 / 4)

    def testInheritance_multilevel_modifier_othermodule2(self):
        from .otherclasses_diff_name import inheritedClassMultilevelOverridedExtended2
        obj = inheritedClassMultilevelOverridedExtended2()
        obj.increment_modifier(4)
        obj.divider_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 2 * (1234 + 4) / 4)<commit_msg>Improved test 92 functions names.<commit_after>#!/usr/bin/python

# -*- coding: utf-8 -*-

"""
PyCOMPSs Inheritance Testbench
==============================
"""

# Imports
import unittest

from pycompss.api.api import compss_wait_on

class testInheritance(unittest.TestCase):

    '''
    INHERITANCE WITHIN THE SAME FILE
    '''

    def test_simple_inheritance_non_modifier(self):
        from .myclass import inheritedClass
        obj = inheritedClass()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235)

    def test_simple_inheritance_modifier(self):
        from .myclass import inheritedClass
        obj = inheritedClass()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235)

    def test_inheritance_overriding_task_non_modifier(self):
        from .myclass import inheritedClassWithOverride
        obj = inheritedClassWithOverride()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235 * 2)

    def test_inheritance_overriding_task_modifier(self):
        from .myclass import inheritedClassWithOverride
        obj = inheritedClassWithOverride()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235 * 2)

    def test_inheritance_extending_task_non_modifier(self):
        from .myclass import inheritedClassExtended
        obj = inheritedClassExtended()
        o = obj.multiplier_non_modifier(4)
        o = compss_wait_on(o)
        self.assertEqual(o, 1234 * 4)

    def test_inheritance_extending_task_modifier(self):
        from .myclass import inheritedClassExtended
        obj = inheritedClassExtended()
        obj.multiplier_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1234 * 4)

    def test_inheritance_multilevel_non_modifier(self):
        from .myclass import inheritedClassMultilevelOverridedExtended
        obj = inheritedClassMultilevelOverridedExtended()
        o = obj.increment_non_modifier(4)
        o = compss_wait_on(o)
        p = obj.divider_non_modifier(4)
        p = compss_wait_on(p)
        self.assertEqual(o, 2 * (1234 + 4))
        self.assertEqual(p, 1234 / 4)

    def test_inheritance_multilevel_modifier(self):
        from .myclass import inheritedClassMultilevelOverridedExtended
        obj = inheritedClassMultilevelOverridedExtended()
        obj.increment_modifier(4)
        obj.divider_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 2 * (1234 + 4) / 4)

    '''
    INHERITANCE FROM A DIFFERENT FILE WITH SAME CLASS NAME
    '''

    def test_simple_inheritance_other_module_same_classname_non_modifier(self):
        from .otherclasses_same_name import inheritedClass
        obj = inheritedClass()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235)

    def test_simple_inheritance_other_module_same_classname_modifier(self):
        from .otherclasses_same_name import inheritedClass
        obj = inheritedClass()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235)

    def test_inheritance_other_module_same_classname_overriding_task_non_modifier(self):
        from .otherclasses_same_name import inheritedClassWithOverride
        obj = inheritedClassWithOverride()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235 * 2)

    def test_inheritance_other_module_same_classname_overriding_task_modifier(self):
        from .otherclasses_same_name import inheritedClassWithOverride
        obj = inheritedClassWithOverride()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235 * 2)

    def test_inheritance_other_module_same_classname_extending_task_non_modifier(self):
        from .otherclasses_same_name import inheritedClassExtended
        obj = inheritedClassExtended()
        o = obj.multiplier_non_modifier(4)
        o = compss_wait_on(o)
        self.assertEqual(o, 1234 * 4)

    def test_inheritance_other_module_same_classname_extending_task_modifier(self):
        from .otherclasses_same_name import inheritedClassExtended
        obj = inheritedClassExtended()
        obj.multiplier_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1234 * 4)

    def test_inheritance_other_module_same_classname_multilevel_non_modifier(self):
        from .otherclasses_same_name import inheritedClassMultilevelOverridedExtended
        obj = inheritedClassMultilevelOverridedExtended()
        o = obj.increment_non_modifier(4)
        o = compss_wait_on(o)
        p = obj.divider_non_modifier(4)
        p = compss_wait_on(p)
        self.assertEqual(o, 2 * (1234 + 4))
        self.assertEqual(p, 1234 / 4)

    def test_inheritance_other_module_same_classname_multilevel_modifier(self):
        from .otherclasses_same_name import inheritedClassMultilevelOverridedExtended
        obj = inheritedClassMultilevelOverridedExtended()
        obj.increment_modifier(4)
        obj.divider_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 2 * (1234 + 4) / 4)

    '''
    INHERITANCE FROM A DIFFERENT FILE WITH DIFFERENT CLASS NAME
    '''

    def test_simple_inheritance_other_module_different_classname_non_modifier(self):
        from .otherclasses_diff_name import inheritedClass2
        obj = inheritedClass2()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235)

    def test_simple_inheritance_other_module_different_classname_modifier(self):
        from .otherclasses_diff_name import inheritedClass2
        obj = inheritedClass2()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235)

    def test_inheritance_other_module_different_classname_overriding_task_non_modifier(self):
        from .otherclasses_diff_name import inheritedClassWithOverride2
        obj = inheritedClassWithOverride2()
        o = obj.increment_non_modifier(1)
        o = compss_wait_on(o)
        self.assertEqual(o, 1235 * 2)

    def test_inheritance_other_module_different_classname_overriding_task_modifier(self):
        from .otherclasses_diff_name import inheritedClassWithOverride2
        obj = inheritedClassWithOverride2()
        obj.increment_modifier(1)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1235 * 2)

    def test_inheritance_other_module_different_classname_extending_task_non_modifier(self):
        from .otherclasses_diff_name import inheritedClassExtended2
        obj = inheritedClassExtended2()
        o = obj.multiplier_non_modifier(4)
        o = compss_wait_on(o)
        self.assertEqual(o, 1234 * 4)

    def test_inheritance_other_module_different_classname_extending_task_modifier(self):
        from .otherclasses_diff_name import inheritedClassExtended2
        obj = inheritedClassExtended2()
        obj.multiplier_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 1234 * 4)

    def test_inheritance_other_module_different_classname_multilevel_non_modifier(self):
        from .otherclasses_diff_name import inheritedClassMultilevelOverridedExtended2
        obj = inheritedClassMultilevelOverridedExtended2()
        o = obj.increment_non_modifier(4)
        o = compss_wait_on(o)
        p = obj.divider_non_modifier(4)
        p = compss_wait_on(p)
        self.assertEqual(o, 2 * (1234 + 4))
        self.assertEqual(p, 1234 / 4)

    def test_inheritance_other_module_different_classname_multilevel_modifier(self):
        from .otherclasses_diff_name import inheritedClassMultilevelOverridedExtended2
        obj = inheritedClassMultilevelOverridedExtended2()
        obj.increment_modifier(4)
        obj.divider_modifier(4)
        obj = compss_wait_on(obj)
        self.assertEqual(obj.get_value(), 2 * (1234 + 4) / 4)
{'fraction_non_alphanumeric': 0.07765710339632118, 'fraction_numerical': 0.023855860380438194, 'mean_word_length': 3.296116504854369, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6989261', 'n_tokens_mistral': 5260, 'n_tokens_neox': 4846, 'n_words': 829}