mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2025-12-31 08:50:48 +00:00
Some functional util code
This commit is contained in:
20
tests/test_utils.py
Normal file
20
tests/test_utils.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import unittest
|
||||
|
||||
from ptulsconv.docparser import apply_appends
|
||||
|
||||
|
||||
class MyTestCase(unittest.TestCase):
|
||||
def test_something(self):
|
||||
v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
expected = [1, 2, 7, 5, 6, 15, 9, 10]
|
||||
|
||||
should = (lambda x, y: y % 4 == 0)
|
||||
do_combine = (lambda x, y: x + y)
|
||||
|
||||
r = apply_appends(iter(v), should, do_combine)
|
||||
r1 = list(r)
|
||||
self.assertEqual(r1, expected)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user