from different_summands import optimal_summands from test.asserts import assert_equal """ Sample 1. Input: 6 Output: 3 1 2 3 Sample 2. Input: 8 Output: 3 1 2 5 Sample 3. Input: 2 Output: 1 2 """ assert_equal([1, 2, 3], optimal_summands(6), "sample 1") assert_equal([1, 2, 5], optimal_summands(8), "sample 2") assert_equal([2], optimal_summands(2), "sample 3")
def test_optimal_summands(n, expected): assert optimal_summands(n) == expected
from different_summands import optimal_summands assert(optimal_summands(8) == [1, 2, 5]) assert(optimal_summands(2) == [2]) assert(optimal_summands(4) == [1, 3]) assert(optimal_summands(6) == [1, 2, 3])
from different_summands import optimal_summands assert (optimal_summands(8) == [1, 2, 5]) assert (optimal_summands(2) == [2]) assert (optimal_summands(4) == [1, 3]) assert (optimal_summands(6) == [1, 2, 3])
def test1M(self): self.assertEqual(len(fast_optimal_summands(1000000)), len(optimal_summands(1000000)))
def test500(self): self.assertEqual(len(fast_optimal_summands(500)), len(optimal_summands(500)))
def test2(self): self.assertEqual(len(fast_optimal_summands(2)), len(optimal_summands(2)))
def test_model(self): self.assertEqual(len(optimal_summands(500)), 31)