Set Operations (Intersection)

Create a function that will return a set of all the common elements of two lists.

list_1 = [1, 5, 6, 4, 8]

list_2 = [1, 6, 10, 5]

all_common_elements(list_1, list2) #{1, 5, 6}

The function should additionally check to see that the parameters are list objects. If they aren't, the function should return a string that says "Params not of type 'list'".

import unittest


class CommonValuesSets(unittest.TestCase):

    def test_generic_list(self):
        self.assertEqual(common_values([1, 5, 7, 1, 24], [1, 2, 3, 4]), {1})

    def test_empty_set(self):
        self.assertEqual(common_values([4, 5, 6, 7], [1, 2, 3]), set())

    def test_invalid_type(self):
        self.assertEqual(
            common_values([1, 2, 3, 4], (1, 2, 3, 4)),
            "Params not of type 'list'")