Mercurial > hg > Lemuriformes
diff tests/test_deduplicate.py @ 18:56596902e9ae default tip
add some setup + tests
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 10 Dec 2017 17:57:03 -0800 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_deduplicate.py Sun Dec 10 17:57:03 2017 -0800 @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +""" +test deduplication +""" + +import os +import unittest +from lemuriformes.deduplicate import deduplicate + + +class TestDeduplicate(unittest.TestCase): + + def test_deduplication(self): + """basic deduplication smoketest""" + + data = [{'a': 'B', 'c': 1, 'd': 'd'}, + {'a': 'a', 'c': 2, 'd': 'e'}, + {'a': 'F', 'c': 1, 'd': 'G'}, # duplicate! + {'a': 'H', 'c': 3, 'd': 'I'}, + {'a': 'b', 'c': 4, 'd': 'J'}, # duplicate! + {'a': 'K', 'c': 5, 'd': 'L'}, + ] + + deduped = deduplicate(data) + expected = [{'a': 'B', 'c': 1, 'd': 'd'}, + {'a': 'a', 'c': 2, 'd': 'e'}, + {'a': 'H', 'c': 3, 'd': 'I'}, + {'a': 'K', 'c': 5, 'd': 'L'}, + ] + assert expected == deduped + + +if __name__ == '__main__': + unittest.main()