def test_compute_common_top_level(self): """Alert Class - Compute Common - No Nested Dictionaries""" record1 = {'a': 1, 'b': 2, 'c': 3} record2 = {'b': 2, 'c': 3, 'd': 4} record3 = {'c': 3, 'd': 4, 'e': 5} assert_equal({'c': 3}, Alert._compute_common([record1, record2, record3]))
def test_compute_common_single_record(self): """Alert Class - Compute Common - Single Record""" # The greatest common subset of a single record is itself record = {'a': 1, 'b': 2, 'c': {'d': {'e': 3}}} assert_equal(record, Alert._compute_common([record]))
def test_compute_common_empty_record(self): """Alert Class - Compute Common - Empty Record List""" assert_equal({}, Alert._compute_common([]))
def test_compute_common_all_identical(self): """Alert Class - Compute Common - Identical Records""" record = {'a': 1, 'b': 2, 'c': {'d': {'e': 3}}} assert_equal(record, Alert._compute_common([record] * 4))
def test_compute_common_different_types(self): """Alert Class - Compute Common - Same Keys, Different Types""" record1 = {'a': 1, 'b': None, 'c': {'d': {'e': 5}, 'f': {'g': 6}}} record2 = {'a': '1', 'b': 0, 'c': []} assert_equal({}, Alert._compute_common([record1, record2]))
def test_compute_common_no_similarities(self): """Alert Class - Compute Common - Empty Common Set""" record1 = {'a': -1, 'b': -2, 'c': -3, 'd': {'e': 0}} record2 = {'a': 1, 'b': 2, 'c': 3} assert_equal({}, Alert._compute_common([record1, record2]))