hibtc / cpymad

Cython binding to MAD-X
http://hibtc.github.io/cpymad/
Other
27 stars 18 forks source link

Add equality comparison for ArrayAttribute (issue #89) #90

Closed chernals closed 3 years ago

coldfix commented 3 years ago

Hey, thanks.

I suggest to change the line to return other == self._values to allow comparison with native lists and other list-like objects. While at it, maybe add __le__ as well, so that comparison works same as with lists.

Best also add tests for

chernals commented 3 years ago

@coldfix OK, done for the operators.

Do you want unit test for the class? In a new file or within one of the two existing ones?

coldfix commented 3 years ago

The same file will be fine, thanks!

Oskari-Tuormaa commented 3 years ago

@coldfix I've created a single testcase testing each of the operators. Let me know if you'd rather i restructure it somehow.

coldfix commented 3 years ago

Great, thanks!

Looks fine for now. I'll wait for the test to pass and then merge. I might later add a small check for comparisons against plain lists.

Oskari-Tuormaa commented 3 years ago

I guess flake8 didn't like my formatting... I've reformatted the lines in question, and doublechecked with flake8; everything seems in order now :+1: