Пример #1
0
    def __column_fields_are_equal(cls, column_1, column_2):
        object_1 = utils.ValuesComparableObject()
        object_1.column = column_1.column
        object_1.description = column_1.description
        object_1.type = column_1.type

        # We need to initialize with the default MODE if it is not fulfilled.
        if not column_1.mode:
            column_1.mode = cls.__DEFAULT_COLUMN_MODE

        object_1.mode = column_1.mode

        # Currently, we simply compare the subcolumns length.
        # The connectors do not handle this field at present.
        object_1.subcolumns_len = len(column_1.subcolumns)

        object_2 = utils.ValuesComparableObject()
        object_2.column = column_2.column
        object_2.description = column_2.description
        object_2.type = column_2.type

        # We need to initialize with the default MODE if it is not fulfilled.
        if not column_2.mode:
            column_2.mode = cls.__DEFAULT_COLUMN_MODE

        object_2.mode = column_2.mode

        # Currently, we simply compare the subcolumns length.
        # The connectors do not handle this field at present.
        object_2.subcolumns_len = len(column_2.subcolumns)

        return object_1 == object_2
Пример #2
0
    def __entries_are_equal(cls, entry_1, entry_2):
        object_1 = utils.ValuesComparableObject()
        object_1.user_specified_system = entry_1.user_specified_system
        object_1.user_specified_type = entry_1.user_specified_type
        object_1.display_name = entry_1.display_name
        object_1.description = entry_1.description
        object_1.linked_resource = entry_1.linked_resource

        object_2 = utils.ValuesComparableObject()
        object_2.user_specified_system = entry_2.user_specified_system
        object_2.user_specified_type = entry_2.user_specified_type
        object_2.display_name = entry_2.display_name
        object_2.description = entry_2.description
        object_2.linked_resource = entry_2.linked_resource

        return object_1 == object_2
    def test_different_entries_should_return_false(self):
        object_1 = utils.ValuesComparableObject()

        object_1.user_specified_system = 'source_system'
        object_1.user_specified_type = 'source_type'
        object_1.display_name = 'display_name'
        object_1.description = 'description'
        object_1.linked_resource = 'linked_resource'

        object_2 = utils.ValuesComparableObject()
        object_2.user_specified_system = 'source_system different'
        object_2.user_specified_type = 'source_type'
        object_2.display_name = 'display_name'
        object_2.description = 'description'
        object_2.linked_resource = 'linked_resource'

        self.assertNotEqual(object_1, object_2)
    def test_comparable_entry_private_fields(self):
        object_1 = utils.ValuesComparableObject()

        expected_value = 'desc'

        getattr(object_1, '__setitem__')('description', expected_value)
        returned_value = getattr(object_1, '__getitem__')('description')

        self.assertEqual(returned_value, expected_value)