Code Duplication    Length = 48-49 lines in 2 locations

tests/test_dict_util.py 1 location

@@ 784-831 (lines=48) @@
781
        }
782
        self.assertEqual(o, r)
783
784
    def test_unique(self):
785
        d = {
786
            'a': {
787
                'x': 1,
788
                'y': 1,
789
            },
790
            'b': {
791
                'x': 2,
792
                'y': 2,
793
            },
794
            'c': {
795
                'x': 1,
796
                'y': 1,
797
            },
798
            'd': {
799
                'x': 1,
800
            },
801
            'e': {
802
                'x': 1,
803
                'y': 1,
804
                'z': 1,
805
            },
806
            'f': {
807
                'x': 2,
808
                'y': 2,
809
            },
810
        }
811
        u.unique(d)
812
        rv = [
813
            {
814
                'x': 1,
815
                'y': 1,
816
            },
817
            {
818
                'x': 2,
819
                'y': 2,
820
            },
821
            {
822
                'x': 1,
823
            },
824
            {
825
                'x': 1,
826
                'y': 1,
827
                'z': 1,
828
            },
829
        ]
830
        self.assertEqual(len(d.keys()), len(rv))
831
        self.assertTrue(all([value in rv for value in d.values()]))
832

tests/test_benedict.py 1 location

@@ 1385-1433 (lines=49) @@
1382
        }
1383
        self.assertEqual(b, r)
1384
1385
    def test_unique(self):
1386
        d = {
1387
            'a': {
1388
                'x': 1,
1389
                'y': 1,
1390
            },
1391
            'b': {
1392
                'x': 2,
1393
                'y': 2,
1394
            },
1395
            'c': {
1396
                'x': 1,
1397
                'y': 1,
1398
            },
1399
            'd': {
1400
                'x': 1,
1401
            },
1402
            'e': {
1403
                'x': 1,
1404
                'y': 1,
1405
                'z': 1,
1406
            },
1407
            'f': {
1408
                'x': 2,
1409
                'y': 2,
1410
            },
1411
        }
1412
        b = benedict(d)
1413
        b.unique()
1414
        rv = [
1415
            {
1416
                'x': 1,
1417
                'y': 1,
1418
            },
1419
            {
1420
                'x': 2,
1421
                'y': 2,
1422
            },
1423
            {
1424
                'x': 1,
1425
            },
1426
            {
1427
                'x': 1,
1428
                'y': 1,
1429
                'z': 1,
1430
            },
1431
        ]
1432
        self.assertEqual(len(b.keys()), len(rv))
1433
        self.assertTrue(all([value in rv for value in b.values()]))
1434