Mercurial > hg > Lemuriformes
view 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 source
#!/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()