def test_is_quick_factor(self): reputation = Reputation(self.df) df_factors = reputation.create_reputation_factors() is_quick = list(df_factors.is_quick.values) expected = [-1, -1, 0, 0, 0, 0, 0, 0, 1] self.assertListEqual(is_quick, expected, message_factor.format('is-quick'))
def test_is_new_factor(self): reputation = Reputation(self.df) df_factors = reputation.create_reputation_factors() is_new = list(df_factors.is_new.values) expected = [1, 1, 0, 0, 0, 0, 0, 0, 0] self.assertListEqual(is_new, expected, message_factor.format('is_first'))
def test_n_grey_factor(self): reputation = Reputation(self.df) df_factors = reputation.create_reputation_factors() n_grey = list(df_factors.n_grey.values) expected = [0, 0, 0, 0, 3, 3, 1, 1, 1] self.assertListEqual(n_grey, expected, message_factor.format('n_grey'))
def test_n_bad_factor(self): reputation = Reputation(self.df) df_factors = reputation.create_reputation_factors() n_bad = list(df_factors.n_bad.values) expected = [0, 0, 0, 0, 0, 1, 0, 0, 0] self.assertListEqual(n_bad, expected, message_factor.format('n_bad'))
def test_n_previous_factor(self): reputation = Reputation(self.df) df_factors = reputation.create_reputation_factors() n_previous = list(df_factors.n_previous.values) expected = [0, 0, 1, 2, 3, 4, 2, 1, 3] self.assertListEqual(n_previous, expected, message_factor.format('n_previous'))
def test_create_reputation_factors(self): reputation = Reputation(self.df) dt = reputation.create_reputation_factors() expected = DataForTests.data_reputation_factors self.assertDictEqual(dt.to_dict(), expected, message_factor.format('create_reputation_factors'))
def test_amount_dev(self): reputation = Reputation(self.df) df_factors = reputation.create_reputation_factors() amount_dev = list(df_factors.amount_dev.values) expected = [-1, -1, 8, 17, 13, 13, 67, 20, 2] self.assertListEqual(amount_dev, expected, message_factor.format('amount_dev'))
def test_delta_days(self): reputation = Reputation(self.df) df_factors = reputation.create_reputation_factors() delta_days = list(df_factors.delta_days.values) expected = [-1, -1, 214, 234, 1202, 744, 1, 11881, 0] self.assertListEqual(delta_days, expected, message_factor.format('delta_days'))
def test_delta_sec(self): reputation = Reputation(self.df) df_factors = reputation.create_reputation_factors() delta_sec = list(df_factors.delta_sec.values) expected = [-1, -1, 772689, 843045, 4327745, 2678645, 3662, 42774649, 1202] self.assertListEqual(delta_sec, expected, message_factor.format('delta_sec'))