Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping is now in collections.abc #1565

Merged
merged 1 commit into from
Nov 22, 2021

Conversation

sandrotosi
Copy link
Contributor

this fixes an error running tests:

__________________________ TestUtils.test_dict_merge ___________________________

self = <tests.basic_tests.TestUtils testMethod=test_dict_merge>

    def test_dict_merge(self):
        filter1 = {"virtualGuests": {"hostname": {"operation": "etst"}}}
        filter2 = {"virtualGuests": {"id": {"operation": "orderBy", "options": [{"name": "sort", "value": ["DESC"]}]}}}
>       result = SoftLayer.utils.dict_merge(filter1, filter2)

tests/basic_tests.py:85: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

dct1 = {'virtualGuests': {'hostname': {'operation': 'etst'}}}
dct2 = {'virtualGuests': {'id': {'operation': 'orderBy', 'options': [{'name': 'sort', 'value': ['DESC']}]}}}

    def dict_merge(dct1, dct2):
        """Recursively merges dct2 and dct1, ideal for merging objectFilter together.
    
        :param dct1: A dictionary
        :param dct2: A dictionary
        :return: dct1 + dct2
        """
    
        dct = dct1.copy()
        for k, _ in dct2.items():
>           if (k in dct1 and isinstance(dct1[k], dict) and isinstance(dct2[k], collections.Mapping)):
E           AttributeError: module 'collections' has no attribute 'Mapping'

SoftLayer/utils.py:71: AttributeError

this fixes an error running tests:

```
__________________________ TestUtils.test_dict_merge ___________________________

self = <tests.basic_tests.TestUtils testMethod=test_dict_merge>

    def test_dict_merge(self):
        filter1 = {"virtualGuests": {"hostname": {"operation": "etst"}}}
        filter2 = {"virtualGuests": {"id": {"operation": "orderBy", "options": [{"name": "sort", "value": ["DESC"]}]}}}
>       result = SoftLayer.utils.dict_merge(filter1, filter2)

tests/basic_tests.py:85: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

dct1 = {'virtualGuests': {'hostname': {'operation': 'etst'}}}
dct2 = {'virtualGuests': {'id': {'operation': 'orderBy', 'options': [{'name': 'sort', 'value': ['DESC']}]}}}

    def dict_merge(dct1, dct2):
        """Recursively merges dct2 and dct1, ideal for merging objectFilter together.
    
        :param dct1: A dictionary
        :param dct2: A dictionary
        :return: dct1 + dct2
        """
    
        dct = dct1.copy()
        for k, _ in dct2.items():
>           if (k in dct1 and isinstance(dct1[k], dict) and isinstance(dct2[k], collections.Mapping)):
E           AttributeError: module 'collections' has no attribute 'Mapping'

SoftLayer/utils.py:71: AttributeError
```
@allmightyspiff allmightyspiff added the Core Issues dealing with core functionality label Nov 21, 2021
@allmightyspiff allmightyspiff self-assigned this Nov 21, 2021
Copy link
Member

@allmightyspiff allmightyspiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this and pointing it out. Looks good.

@allmightyspiff allmightyspiff merged commit c07fded into softlayer:master Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Issues dealing with core functionality
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants