You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defdeep_equality(self, left: str, right: str) ->str:
""" All tests are assertions that compare deep equality between left and right. Use == for primitive types and Equals for objects """#Empty the union declarationsself.union_decls= {}
ifself.is_primitive_type(self.translated_return_type):
returnf" Debug.Assert({left} == {right});"else:
returnf" Debug.Assert({left}.Equals({right}));"
instead, we can change to this:
defdeep_equality(self, left: str, right: str) ->str:
""" All tests are assertions that compare deep equality between left and right. Use == for primitive types and Equals for objects """#Empty the union declarationsself.union_decls= {}
ifself.is_primitive_type(self.translated_return_type):
returnf" Debug.Assert({left} == {right});"elifself.list_typeinself.translated_return_type:
returnf" Debug.Assert({left}.SequenceEqual({right}));"elifself.dict_typeinself.translated_return_type:
returnf" Debug.Assert({left}.Count == {right}.Count && !{left}.Except({right}).Any()));"else:
returnf" Debug.Assert({left}.Equals({right}));"
The text was updated successfully, but these errors were encountered:
Issue 1: comparing lists
example program:
HumanEval_9_rolling_max
should be changed to
.SequenceEqual
, asEquals
checks for reference equality, where as the second checks for equality element-wise (source)Issue 2: comparing dictionaries
example program
HumanEval_111_histogram
source
Proposed change
currently in
humaneval_to_cs.py
, we have:instead, we can change to this:
The text was updated successfully, but these errors were encountered: