from advent_of_code.day2.gift import Gift dimensions = open("input.txt").readlines() gift = Gift(dimensions) print('How many total square feet of wrapping paper should they order?') print(gift.calculation_of_wrapping_paper()) print('How many total feet of ribbon should they order?') print(gift.calculation_of_feet_ribbon())
def test_one_gift(self): self.assertEqual( Gift(['2x3x4']).calculation_of_wrapping_paper(), 58)
def test_two_gift(self): self.assertEqual( Gift(['2x3x4', '1x1x10']).calculation_of_wrapping_paper(), 101)
def test_negative_number(self): self.assertRaises( TypeError, Gift(['-2x3x4']).calculation_of_wrapping_paper(), ['-2x3x4'])
def test_two_dimensions(self): with self.assertRaises(Exception) as context: Gift(['2x2']).calculation_of_wrapping_paper() self.assertTrue('Missing parameters' in str(context.exception))
def test_empty_list(self): self.assertEqual( Gift([]).calculation_of_wrapping_paper(), 0)
def test_value_feet_ribbon(self): self.assertEqual( Gift(['2x3x4']).calculation_of_feet_ribbon(), 34)
def test_value_with_line_break(self): self.assertEqual( Gift(['2x3x4\n']).calculation_of_wrapping_paper(), 58)