1. bugfix equal check with[] will return list[false, true],
and always True in next step check
2. in assert_res() leverage '==' will never assert even if
they are not equal
Change-Id: I683e3489d45b98b508f8ab8b6ef268ca9a1ebd5f
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
self.date = date
self.status = status
self.date = date
self.status = status
+ def __eq__(self, other):
+ return (self.date == other.date and
+ self.status == other.status)
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
@swagger.model()
class ScenarioScore(models.ModelBase):
@swagger.model()
class ScenarioScore(models.ModelBase):
self.date = date
self.score = score
self.date = date
self.score = score
+ def __eq__(self, other):
+ return (self.date == other.date and
+ self.score == other.score)
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
@swagger.model()
class ScenarioProject(models.ModelBase):
@swagger.model()
class ScenarioProject(models.ModelBase):
'trust_indicators': ScenarioTI}
def __eq__(self, other):
'trust_indicators': ScenarioTI}
def __eq__(self, other):
- return [self.project == other.project and
+ return (self.project == other.project and
self._customs_eq(other) and
self._scores_eq(other) and
self._customs_eq(other) and
self._scores_eq(other) and
def __ne__(self, other):
return not self.__eq__(other)
def __ne__(self, other):
return not self.__eq__(other)
return set(self.customs) == set(other.customs)
def _scores_eq(self, other):
return set(self.customs) == set(other.customs)
def _scores_eq(self, other):
- return set(self.scores) == set(other.scores)
+ return self.scores == other.scores
- return set(self.trust_indicators) == set(other.trust_indicators)
+ return self.trust_indicators == other.trust_indicators
return {'projects': ScenarioProject}
def __eq__(self, other):
return {'projects': ScenarioProject}
def __eq__(self, other):
- return [self.version == other.version and
+ return (self.version == other.version and
self.owner == other.owner and
self.owner == other.owner and
- self._projects_eq(other)]
+ self._projects_eq(other))
def __ne__(self, other):
return not self.__eq__(other)
def __ne__(self, other):
return not self.__eq__(other)
return {'versions': ScenarioVersion}
def __eq__(self, other):
return {'versions': ScenarioVersion}
def __eq__(self, other):
- return [self.installer == other.installer and self._versions_eq(other)]
+ return (self.installer == other.installer and self._versions_eq(other))
def __ne__(self, other):
return not self.__eq__(other)
def __ne__(self, other):
return not self.__eq__(other)
return not self.__eq__(other)
def __eq__(self, other):
return not self.__eq__(other)
def __eq__(self, other):
- return [self.name == other.name and self._installers_eq(other)]
+ return (self.name == other.name and self._installers_eq(other))
def _installers_eq(self, other):
for s_install in self.installers:
def _installers_eq(self, other):
for s_install in self.installers:
"scores": [
{
"date": "2017-01-08 22:46:44",
"scores": [
{
"date": "2017-01-08 22:46:44",
}
],
"trust_indicators": [
}
],
"trust_indicators": [
req = self.req_d
self.assertIsNotNone(scenario._id)
self.assertIsNotNone(scenario.creation_date)
req = self.req_d
self.assertIsNotNone(scenario._id)
self.assertIsNotNone(scenario.creation_date)
-
- scenario == models.Scenario.from_dict(req)
+ self.assertEqual(scenario, models.Scenario.from_dict(req))
@staticmethod
def _set_query(*args):
@staticmethod
def _set_query(*args):
@update_partial('_update', '_success')
def test_changeOwner(self, scenario):
new_owner = 'new_owner'
@update_partial('_update', '_success')
def test_changeOwner(self, scenario):
new_owner = 'new_owner'
- scenario['installers'][0]['versions'][0]['owner'] = 'www'
+ scenario['installers'][0]['versions'][0]['owner'] = new_owner
return new_owner, scenario
def _add(self, update_req, new_scenario):
return new_owner, scenario
def _add(self, update_req, new_scenario):