Created
September 22, 2019 15:26
-
-
Save danielloader/3e28fc915728e043b94711879fb9f479 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import object_finder | |
import unittest | |
class Test(unittest.TestCase): | |
def test_technical_skills_test_1(self): | |
result = object_finder.process_dict( | |
{"a": {"b": {"c": "d"}}}, "a/b/c" | |
) | |
self.assertEqual(result, "d") | |
def test_technical_skills_test_2(self): | |
result = object_finder.process_dict( | |
{"x": {"y": {"z": "a"}}}, "x/y/z" | |
) | |
self.assertEqual(result, "a") | |
def test_deep_1(self): | |
result = object_finder.process_dict( | |
{"a": {"b": {"c": {"d": {"e": "f"}}}}}, | |
"a/b/c/d/e", | |
) | |
self.assertEqual(result, "f") | |
def test_cheese_1(self): | |
result = object_finder.process_dict( | |
{"important": {"notice": {"cheese": "good"}}}, | |
"important/notice/cheese", | |
) | |
self.assertEqual(result, "good") | |
def test_return_object_1(self): | |
result = object_finder.process_dict( | |
{"important": {"notice": {"python": "good"}}}, | |
"important/notice", | |
) | |
self.assertEqual(result, {"python": "good"}) | |
def test_iterate_arrays_1(self): | |
result = object_finder.process_dict( | |
{ | |
"array": [{"example": "key"}], | |
"object_array": {"1": {"example": "key"}}, | |
}, | |
"array/0/example", | |
) | |
self.assertEqual(result, "key") | |
if __name__ == "__main__": | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment