Ignore:
Timestamp:
21 Oct 2012, 10:43:54 (12 years ago)
Author:
uli
Message:

Add a helper to provide a (Python 3 compatible) product calculator for sequences of numbers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_helpers.py

    r8632 r9372  
    3939    implements(IFakeObject)
    4040
     41class SimpleHelpersTestCase(unittest.TestCase):
     42    # Tests for simple functions in `helpers`.
     43    def test_product(self):
     44        # the product will return zero without input
     45        result1 = helpers.product([])
     46        result2 = helpers.product([1,2,3])
     47        result3 = helpers.product([], start=5)
     48        result4 = helpers.product([1,2,3], start=5)
     49        self.assertEqual(result1, 0)
     50        self.assertEqual(result2, 6)
     51        self.assertEqual(result3, 0)
     52        self.assertEqual(result4, 30)
     53        return
     54
    4155class RemoveFileOrDirectoryTestCase(unittest.TestCase):
    4256
     
    447461            contents, '\r\n')
    448462        return
     463
    449464
    450465def test_suite():
     
    463478        GetFileFormatTestCase,
    464479        MergeCSVFileTestCase,
     480        SimpleHelpersTestCase,
    465481        ]:
    466482        suite.addTests(
Note: See TracChangeset for help on using the changeset viewer.