[
https://issues.apache.org/jira/browse/AIRFLOW-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julia updated AIRFLOW-4054:
---------------------------
Description:
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.
was:
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.
> 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
> 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)