def test_no_revert(self): """ Normal non-revert.""" data = { 'name': 'Name 1', 'cmp_name': 'Name 1', 'change': 12, 'cmp_change': 24, 'early_dt': dt(2019, 1, 1, 12, 0), 'late_dt': dt(2019, 1, 3, 12, 0), 'later_revert': False, } self.assertFalse(revert_heuristic(**data))
def test_NaN_values(self): """ Handle NaN values correctly.""" data = { 'name': 'Name 1', 'change': 12, 'early_dt': dt(2019, 12, 31, 12, 0), 'cmp_name': np.NaN, 'cmp_change': np.NaN, 'late_dt': pd.NaT, 'later_revert': np.NaN, } self.assertFalse(revert_heuristic(**data))
def test_revert_field(self): """Revert marked by an revert field.""" data = { 'name': 'Name 1', 'cmp_name': 'Name 2', 'change': 12, 'cmp_change': 24, 'early_dt': dt(2019, 1, 1, 12, 0), 'late_dt': dt(2019, 1, 3, 12, 0), 'later_revert': True, } self.assertTrue(revert_heuristic(**data))
def test_different_pagenames(self): """ Non-revert because varying pagenames.""" data = { 'name': 'Name 1', 'cmp_name': 'Name 2', 'change': 12, 'cmp_change': -12, 'early_dt': dt(2019, 1, 1, 12, 0), 'late_dt': dt(2019, 1, 3, 12, 0), 'later_revert': False, } self.assertFalse(revert_heuristic(**data))