Closed precicely closed 2 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 71.84%. Comparing base (
8eca448
) to head (fb2dc74
). Report is 1 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Also, in check_element_equality
, there is a typo. I missed it in my first review. The argument should be actual_element
not actual_elelment
. Perhaps something like this would be more readable and efficient as well?
def check_element_equality(
actual_element: Element,
expected_element: Element,
) -> bool:
for field in dataclasses.fields(expected_element):
expected = getattr(expected_element, field.name)
actual = getattr(actual_element, field.name)
if isinstance(expected, np.ndarray):
if not np.allclose(actual, expected):
return False
elif actual != expected:
return False
return True
Hi @waltsims, no problem. Will implement as you suggest.
Have now made those changes. That said, and I don't think this is the pull request to do it but perhaps a more elegant solution is to make the __eq__
method of the Element
class just work? For example, it would be much nicer to write:
element_1 == element_2
As opposed to the check_element_equality
function.
I'm guessing the problem right now is the equality of the numpy arrays... I'm happy to take this on if you think it's worthwhile?
That would be a great addition!
As you said please create a separate PR those changes. Looking forward to it.
Will do. Got wrapped up in other things yesterday.
It looks like I missed something in my original review. I hope you don't mind that I have merged master into your PR to address conflicts.