[ 
https://issues.apache.org/jira/browse/AIRFLOW-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16788805#comment-16788805
 ] 

ASF GitHub Bot commented on AIRFLOW-4054:
-----------------------------------------

XD-DENG commented on pull request #4886: [AIRFLOW-4054] Fix 
assertEqualIgnoreMultipleSpaces util and add tests
URL: https://github.com/apache/airflow/pull/4886
 
 
   
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> assertEqualIgnoreMultipleSpaces doesn't have test and passes when it should 
> fail
> --------------------------------------------------------------------------------
>
>                 Key: AIRFLOW-4054
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4054
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: utils
>            Reporter: Julia
>            Assignee: Julia
>            Priority: Major
>
> assertEqualIgnoreMultipleSpaces util is supposed to compare two strings 
> trimming white spaces. Currently assertion passes even when strings are 
> completely different. No tests exist for this.
>   
> {code:java}
> def assertEqualIgnoreMultipleSpaces(case, first, second, msg=None):
>     def _trim(s):
>         re.sub(r"\s+", " ", s.strip())
>     return case.assertEqual(_trim(first), _trim(second), msg)
> {code}
>  
> Reason is that _trim(s) method doesn't have a return statement, therefore 
> returning None for first and second trimmed string. Is causes assertEqual 
> compare None with None, forcing assertion assertEqualIgnoreMultipleSpaces to 
> pass.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to