18
|
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()
|