stanley-king 2 年之前
父節點
當前提交
17d0cd8527
共有 1 個文件被更改,包括 24 次插入0 次删除
  1. 24 0
      plot/testPlot.py

+ 24 - 0
plot/testPlot.py

@@ -157,6 +157,30 @@ class MyTestCase(unittest.TestCase):
         consumer.quit()
         consumer.join()
 
+    def test_merge(self):
+        from collections import defaultdict
+        import time as time
+
+        def merge(l,r):
+            for name,ls in l.items():
+                if name in r:
+                    ls.extend(r[name])
+                    k = set(ls)
+                    r[name] = list(k)
+                else:
+                    r[name] = ls
+            return r
+
+        all = defaultdict(list)
+        a = {'yunchonggongfs': [(4, 100), (4, 30), (4, 50)]}
+        b = {'yunchonggongfs': [(4, 100), (4, 200), (4, 50)]}
+
+        all = merge(a,all)
+        all = merge(b,all)
+        x = 0;
+
+
+
 
 if __name__ == '__main__':
     unittest.main()