def test_5_make_weight_not_possible(self): weights = (2, 4, 8, 12) n = 63 answer = ps1.dp_make_weight(weights, n, memo={}) self.assertEqual( answer, None, 'Expected dp_make_make_weight to return %s with target weight %s and cow weights %s, but got %s' % (None, n, weights, answer))
def test_6_very_large_input(self): weights = (3, 5, 8, 9, 15, 19, 22, 27, 28, 32, 36, 40, 51, 52, 53, 54, 60, 69, 73, 88, 91, 93, 102, 105) n = 1000 answer = ps1.dp_make_weight(weights, n, memo={}) self.assertEqual( answer, 332, 'Expected dp_make_make_weight to return %s with target weight %s and cow weights %s, but got %s' % (332, n, weights, answer))
def test_4_make_weight_sample(self): weights = (3, 5, 8, 9) n = 64 answer = ps1.dp_make_weight(weights, n, memo={}) self.assertIsInstance( answer, int, "dp_make_weight should return an integer, but instead returned a %s" % type(answer)) self.assertEqual( answer, 20, 'Expected dp_make_make_weight to return %s with target weight %s and cow weights %s, but got %s' % (20, n, weights, answer))