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

class Point doesn't support equality comparison #623

Closed
hf-kklein opened this issue Dec 19, 2023 · 5 comments · Fixed by #625
Closed

class Point doesn't support equality comparison #623

hf-kklein opened this issue Dec 19, 2023 · 5 comments · Fixed by #625
Labels
bug Something isn't working
Milestone

Comments

@hf-kklein
Copy link
Contributor

hf-kklein commented Dec 19, 2023

Specifications

  • Client Version: influxdb-client==1.39.0
  • InfluxDB Version: irrelevant
  • Platform: windows

Code sample to reproduce problem

def test_point_equality():
    point_a = (
        Point("asd")
        .tag("foo", "bar")
        .field("value", 123.45)
        .time(datetime(2023, 12, 19, 13, 27, 42, 215000, tzinfo=timezone.utc))
    )

    point_b = (
        Point("asd")
        .tag("foo", "bar")
        .field("value", 123.45)
        .time(datetime(2023, 12, 19, 13, 27, 42, 215000, tzinfo=timezone.utc))
    )

    assert point_a == point_b

Expected behavior

Points with equal measurement_name, tags, fields and datetime shall be equal using the == comparison.

Actual behavior

they are not equal:

  assert point_a == point_b

E assert <influxdb_client.client.write.point.Point object at 0x0000022C05D11110> == <influxdb_client.client.write.point.Point object at 0x0000022C05D11150>

But

assert point_a.to_line_protocol() == point_b.to_line_protocol()

is fulfilled.

Additional info

Maybe I'm missing a key concept here why points are not equatable but line protocols are?

@hf-kklein hf-kklein added the bug Something isn't working label Dec 19, 2023
@bednar
Copy link
Contributor

bednar commented Jan 3, 2024

HI @hf-kklein,

thanks for using our client and report this issue.

Is this something you would be willing to help with? All PR is welcome and we will be happy to review your submission.

Regards

@hf-kklein
Copy link
Contributor Author

will open a PR and report back.

@bednar
Copy link
Contributor

bednar commented Jan 3, 2024

@hf-kklein thanks a lot

@hf-kklein
Copy link
Contributor Author

@bednar #625 . Sorry for the repetitive test cases. Didn't know how to properly parametrize the tests with only the stdlib unittest lib.

@bednar
Copy link
Contributor

bednar commented Jan 4, 2024

@hf-kklein it's ok

@bednar bednar added this to the 1.41.0 milestone Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants