예제 #1
0
 def test_merge_dicts_with_conflict_raise_exception(self):
     updater = WPTExpectationsUpdater(self.mock_host())
     # Both dicts here have the key "one", and the value is not equal.
     with self.assertRaises(ValueError):
         updater.merge_dicts(
             {
                 'external/wpt/test/path.html': {
                     'one': {
                         'expected': 'FAIL',
                         'actual': 'PASS'
                     },
                     'two': {
                         'expected': 'FAIL',
                         'actual': 'TIMEOUT'
                     },
                     'three': {
                         'expected': 'FAIL',
                         'actual': 'PASS'
                     },
                 },
             }, {
                 'external/wpt/test/path.html': {
                     'one': {
                         'expected': 'FAIL',
                         'actual': 'TIMEOUT'
                     },
                 }
             })
예제 #2
0
    def test_merge_dicts_merges_second_dict_into_first(self):
        updater = WPTExpectationsUpdater(self.mock_host())
        one = {
            'fake/test/path.html': {
                'one': {'expected': 'FAIL', 'actual': 'PASS'},
                'two': {'expected': 'FAIL', 'actual': 'PASS'},
            }
        }
        two = {
            'external/wpt/test/path.html': {
                'one': {'expected': 'FAIL', 'actual': 'PASS'},
                'two': {'expected': 'FAIL', 'actual': 'TIMEOUT'},
                'three': {'expected': 'FAIL', 'actual': 'PASS'},
            }
        }
        three = {
            'external/wpt/test/path.html': {
                'four': {'expected': 'FAIL', 'actual': 'PASS'},
            }
        }

        output = updater.merge_dicts(one, three)
        self.assertEqual(output, one)
        output = updater.merge_dicts(two, three)
        self.assertEqual(output, two)