Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Fix sdiffstore #117

Merged
merged 1 commit into from
Mar 28, 2016
Merged

Fix sdiffstore #117

merged 1 commit into from
Mar 28, 2016

Conversation

mt3925
Copy link
Contributor

@mt3925 mt3925 commented Jan 6, 2016

No description provided.

@Grokzen
Copy link
Owner

Grokzen commented Jan 6, 2016

Hi @mt3925
Could you please give a small example when/how it breaks so that i can understand why this is needed?

@mt3925
Copy link
Contributor Author

mt3925 commented Jan 7, 2016

Hi @Grokzen

def sdiffstore(self, dest, keys, *args):
    """
    Store the difference of sets specified by ``keys`` into a new
    set named ``dest``.  Returns the number of keys in the new set.
    Overwrites dest key if it exists.
    Cluster impl:
        Use sdiff() --> Delete dest key --> store result in dest key
    """
    res = self.sdiff(keys, *args)
    self.delete(dest)

    if not res:
        return 0
    return self.sadd(dest, *res)

The difference of sets specified by keys may be empty, but the argument res of the function sadd must be non-empty.

@Grokzen
Copy link
Owner

Grokzen commented Mar 28, 2016

Hi @mt3925. I tested this manually and created a failing test to verify this was broken and that this fixes and it does properly. I will add the test and a line in the CHANGES file after merging this.

@Grokzen Grokzen merged commit 4528e5b into Grokzen:unstable Mar 28, 2016
@coveralls
Copy link

coveralls commented Nov 28, 2017

Coverage Status

Changes Unknown when pulling e38e874 on mt3925:unstable into ** on Grokzen:unstable**.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants