You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/10/17 00:50:01 UTC

[GitHub] [beam] tvalentyn commented on a change in pull request #15734: Minor: Fix `frames_test.py` equality check for non-frame outputs

tvalentyn commented on a change in pull request #15734:
URL: https://github.com/apache/beam/pull/15734#discussion_r730112634



##########
File path: sdks/python/apache_beam/dataframe/frames_test.py
##########
@@ -187,7 +187,7 @@ def _run_test(
         else:
           cmp = lambda x: np.isclose(expected, x)
       else:
-        cmp = expected.__eq__
+        cmp = lambda x: x == expected

Review comment:
       1) this sounds more like `eq` than `cmp`. 
   2) Don't have full context about the classes involved here, but if expected.__eq__(x) doesn't work well, will x.__eq__(expected) always work? Note that `x == expected` may fall back to `expected.__eq__(x)` in some casses.

##########
File path: sdks/python/apache_beam/dataframe/frames_test.py
##########
@@ -187,7 +187,7 @@ def _run_test(
         else:
           cmp = lambda x: np.isclose(expected, x)
       else:
-        cmp = expected.__eq__
+        cmp = lambda x: x == expected

Review comment:
       1) this sounds more like `eq` than `cmp`. 
   2) Don't have full context about the classes involved here, but if `expected.__eq__(x)` doesn't work well, will `x.__eq__(expected)` always work? Note that `x == expected` may fall back to `expected.__eq__(x)` in some casses.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org