Closed aantn closed 3 years ago
Hi, Thank you for the comments. I'll try to address everything below by category but let me know if I've missed anything:
I think fixed the other issues, except for adding a unit test that object_at_path() plays well with DiffDetail.path. I'll do that later today or tomorrow. Let me know what you think of all the other changes.
On an unrelated note, I think you still have an issue with setup.py(). Also, can you add a doc specifying how you run the unittests? I mucked around with pytest a little, but I had to change PYTHONPATH to get it to work. How do you run it?
I've added a test for checking object_at_path and the test passes successfully.
On the other hand, the following test (not currently committed) does not pass because object_at_path can't traverse dictionary keys.
def test122():
"""
test that you can run object_at_path on the path returned by diff()
"""
pod = Pod(
spec=PodSpec(
containers=[
Container(name="a", resources=ResourceRequirements(limits={"foo": "bar"}))
]
)
)
pod2 = copy.deepcopy(pod)
pod2.spec.containers[0].resources.limits["foo"] = "blah"
diff = pod.diff(pod2)
print(diff)
print("object at path is", pod.object_at_path(diff[0].path))
Lmk how you want to handle this.
Hi-- Thanks for the changes; they look good.
I understand your point re: diff() vs _diff(); that works well.
I also get what you're saying in regards to incompatible vs type changed. I think I'd prefer consistent error reporting regardless of where the error occurred if it's the same kind of condition generating the error. I'll deal with that change, so don't trouble yourself there.
I like your solution for the changing the use of 'Key' when an attribute was being discussed; that works for me.
Lastly, I've been thinking about the removal of 'attr' from DiffDetail, and I think I'm going to put it back, but perhaps as a property. I know you don't use it, but there have been a few hundred downloads of Hikaru since I announced it and I don't want to break anyone's code more than necessary. The change of import is minor compared to the number of times someone might look at an attr.
Awesome, thank you. I'm going to open another ticket re. adding support to object_at_path for dictionary lookups.
Codecov Report
100.00% <ø> (ø)
98.34% <100.00%> (+0.05%)
Continue to review full report at Codecov.