kytos / of_core

Kytos Main OpenFlow Network Application (NApp)
MIT License
1 stars 19 forks source link

Implement `FlowBase.__eq__` to allow comparing two flows #102

Closed cmagnobarbosa closed 3 years ago

cmagnobarbosa commented 3 years ago

:octocat: Are you working on some issue? Identify the issue!

Fix #101

:bookmark_tabs: Description of the Change

Override __eq__ of FlowBase Class to compare two flows.

:page_facing_up: Release Notes

rmotitsuki commented 3 years ago

One suggestion, add an inequality unit test just to make sure it's working too.

josemauro commented 3 years ago

@rmotitsuki we already have a test called "testeqsuccess_with_different_flows" that tests an inequality. https://github.com/kytos/of_core/blob/5536d7ff381c71462b5d4b9de754eb9ffc387fdc/tests/unit/test_flow.py#L130 Also, we have a "testeqfail" that tests the case where "eq" receives objects with different types. https://github.com/kytos/of_core/blob/5536d7ff381c71462b5d4b9de754eb9ffc387fdc/tests/unit/test_flow.py#L171

rmotitsuki commented 3 years ago

@rmotitsuki we already have a test called "testeqsuccess_with_different_flows" that tests an inequality.

https://github.com/kytos/of_core/blob/5536d7ff381c71462b5d4b9de754eb9ffc387fdc/tests/unit/test_flow.py#L130

Also, we have a "testeqfail" that tests the case where "eq" receives objects with different types. https://github.com/kytos/of_core/blob/5536d7ff381c71462b5d4b9de754eb9ffc387fdc/tests/unit/test_flow.py#L171

@josemauro You test if the equality operator is False. Inequality operator is the " != ". It should be fine in Python3, but is just another unit test to make sure everything is working.