singnet / das-atom-db

Persistence layer
MIT License
2 stars 0 forks source link

[#191] adding skipped test for future evaluation #192

Closed angeloprobst closed 2 months ago

angeloprobst commented 2 months ago

Relates to #191

Added a new test case, skipped for now, which must be enabled in the future once we get some refactorings done.

This is the error raised if the skip decorator is removed and a make unit-tests is executed:

>       _, links = database.get_matched_links('Connectivity', target_handles)

tests/unit/adapters/test_ram_only.py:483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hyperon_das_atomdb/adapters/ram_only.py:545: in get_matched_links
    link_handle = self.get_link_handle(link_type, target_handles)
hyperon_das_atomdb/adapters/ram_only.py:494: in get_link_handle
    link_handle = self.link_handle(link_type, target_handles)
hyperon_das_atomdb/database.py:123: in link_handle
    return ExpressionHasher.expression_hash(named_type_hash, target_handles)
hyperon_das_atomdb/utils/expression_hasher.py:86: in expression_hash
    return ExpressionHasher.composite_hash([named_type_hash, *elements])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

hash_base = ['9bd9d0ebc081bd74f5bef4e136bb1aed', ['5b34c54bee150c04f9fa584b899dc030', 'af12f10f9ae2002a1607ba0b47ba8407'], ['5b34c54bee150c04f9fa584b899dc030', '1cdffc6b0b89ff41d68bec237481d1e1']]

    @staticmethod
    def composite_hash(hash_base: str | list[str]) -> str:
        """
        Compute the composite hash for the given base.

        This method generates a composite hash using the MD5 hashing algorithm. It can take
        either a single string or a list of strings as the base. If a list is provided, the
        elements are joined with a separator before hashing.

        Args:
            hash_base (str | list[str]): The base for the composite hash, either a single string
                                         or a list of strings.

        Returns:
            str: The MD5 hash of the composite base as a hexadecimal string.
        """
        if isinstance(hash_base, str):
            return hash_base
        elif isinstance(hash_base, list):
            if len(hash_base) == 1:
                return hash_base[0]
            else:
                return ExpressionHasher._compute_hash(
>                   ExpressionHasher.compound_separator.join(hash_base)
                )
E               TypeError: sequence item 1: expected str instance, list found

hyperon_das_atomdb/utils/expression_hasher.py:111: TypeError