Mercurial > hg > Lemuriformes
comparison 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 |
comparison
equal
deleted
inserted
replaced
17:4793f99b73e0 | 18:56596902e9ae |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 """ | |
4 test deduplication | |
5 """ | |
6 | |
7 import os | |
8 import unittest | |
9 from lemuriformes.deduplicate import deduplicate | |
10 | |
11 | |
12 class TestDeduplicate(unittest.TestCase): | |
13 | |
14 def test_deduplication(self): | |
15 """basic deduplication smoketest""" | |
16 | |
17 data = [{'a': 'B', 'c': 1, 'd': 'd'}, | |
18 {'a': 'a', 'c': 2, 'd': 'e'}, | |
19 {'a': 'F', 'c': 1, 'd': 'G'}, # duplicate! | |
20 {'a': 'H', 'c': 3, 'd': 'I'}, | |
21 {'a': 'b', 'c': 4, 'd': 'J'}, # duplicate! | |
22 {'a': 'K', 'c': 5, 'd': 'L'}, | |
23 ] | |
24 | |
25 deduped = deduplicate(data) | |
26 expected = [{'a': 'B', 'c': 1, 'd': 'd'}, | |
27 {'a': 'a', 'c': 2, 'd': 'e'}, | |
28 {'a': 'H', 'c': 3, 'd': 'I'}, | |
29 {'a': 'K', 'c': 5, 'd': 'L'}, | |
30 ] | |
31 assert expected == deduped | |
32 | |
33 | |
34 if __name__ == '__main__': | |
35 unittest.main() |