Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

fix: use eq method for ne for SnowflakeObject #743

Merged
merged 1 commit into from
Jan 1, 2023

Conversation

AstreaTSS
Copy link
Contributor

This makes sure objects without an "id" attribute are still correctly compared.

What type of pull request is this?

  • Non-breaking code change
  • Breaking code change
  • Documentation change/addition
  • Tests change
  • CI change
  • Other: [Replace with a description]

Description

Trying to compare a SnowflakeObject to something else that didn't have an id attribute via != would always error out. This PR fixes that by making __ne__ use __eq__.

Changes

  • Make SnowflakeObject.__ne__ return the opposite of __eq__ instead of using custom logic. Honestly, I think you could just remove it altogether, but this was safer.

Test Scenario(s)

Just use SnowflakeObject(SOME_ID) != None.

Checklist

  • I've formatted my code with Black
  • I've added docstrings to everything I've touched
  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x
  • I've tested my changes
  • I've added tests for my code - if applicable
  • I've updated the documentation - if applicable

This makes sure objects without an "id" attribute are still correctly compared.
@LordOfPolls LordOfPolls merged commit d1f7c8a into NAFTeam:dev Jan 1, 2023
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.

2 participants