Code Duplication    Length = 48-49 lines in 2 locations

tests/test_benedict.py 1 location

@@ 1352-1400 (lines=49) @@
1349
        }
1350
        self.assertEqual(b, r)
1351
1352
    def test_unique(self):
1353
        d = {
1354
            'a': {
1355
                'x': 1,
1356
                'y': 1,
1357
            },
1358
            'b': {
1359
                'x': 2,
1360
                'y': 2,
1361
            },
1362
            'c': {
1363
                'x': 1,
1364
                'y': 1,
1365
            },
1366
            'd': {
1367
                'x': 1,
1368
            },
1369
            'e': {
1370
                'x': 1,
1371
                'y': 1,
1372
                'z': 1,
1373
            },
1374
            'f': {
1375
                'x': 2,
1376
                'y': 2,
1377
            },
1378
        }
1379
        b = benedict(d)
1380
        b.unique()
1381
        rv = [
1382
            {
1383
                'x': 1,
1384
                'y': 1,
1385
            },
1386
            {
1387
                'x': 2,
1388
                'y': 2,
1389
            },
1390
            {
1391
                'x': 1,
1392
            },
1393
            {
1394
                'x': 1,
1395
                'y': 1,
1396
                'z': 1,
1397
            },
1398
        ]
1399
        self.assertEqual(len(b.keys()), len(rv))
1400
        self.assertTrue(all([value in rv for value in b.values()]))
1401

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