def _test_cached_dframe(self, name, original_formula, dynamic): formula = not dynamic and self.column_labels_to_slugs[original_formula] for idx, row in self.dframe.iterrows(): try: result = np.float64(row[name]) places = self.places if dynamic: # downsample and set low precision for time comparison stored = (parse_date_to_unix_time(self.now) - parse_date_to_unix_time(row['submit_date']) ) / 100 result = int(result / 100) places = 0 else: stored = np.float64(row[formula]) # one np.nan != np.nan, continue if we have two nan values if np.isnan(result) and np.isnan(stored): continue msg = self._equal_msg(result, stored, original_formula) self.assertAlmostEqual(result, stored, places, msg) except ValueError: msg = self._equal_msg(row[name], row[formula], formula) self.assertEqual(row[name], row[formula], msg)
def eval(self, row, dataset): return parse_date_to_unix_time(now())