def test_safe_get_simple(self): key = "key" test_dict = {key: 0} output_nokey = panexport.safeget(test_dict, "nokey") output_key = panexport.safeget(test_dict, "key") self.assertEqual(output_nokey, []) self.assertEqual(output_key, [0])
def test_safe_get_nested(self): key1 = "key1" key2 = "key2" nested_dict = {key1: {key2: "success"}} output_nokey = panexport.safeget(nested_dict, "key1", "nokey") output_key = panexport.safeget(nested_dict, "key1", "key2") self.assertEqual(output_nokey, []) self.assertEqual(output_key, ["success"])
def test_safe_get_simple(self): key = "key" test_dict = { key: 0 } output_nokey = panexport.safeget(test_dict, "nokey") output_key = panexport.safeget(test_dict, "key") self.assertEqual(output_nokey, []) self.assertEqual(output_key, [0])
def test_safe_get_nested(self): key1 = "key1" key2 = "key2" nested_dict = { key1: { key2: "success" } } output_nokey = panexport.safeget(nested_dict, "key1", "nokey") output_key = panexport.safeget(nested_dict, "key1", "key2") self.assertEqual(output_nokey, []) self.assertEqual(output_key, ["success"])