-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f71d4e
commit 94c63bb
Showing
2 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import unittest | ||
|
||
from deepgetter.deep_get import deep_get | ||
|
||
|
||
class TestGetByType(unittest.TestCase): | ||
def test_with_basic_number(self): | ||
""" | ||
Test basic number | ||
""" | ||
data: int = 39 | ||
result = deep_get(data, '') | ||
self.assertEqual(result, 39) | ||
|
||
def test_with_number_in_dict(self): | ||
""" | ||
Test basic number inside structure | ||
""" | ||
data: dict = { | ||
'value': 39, | ||
} | ||
result = deep_get(data, 'value') | ||
self.assertEqual(result, 39) | ||
|
||
def test_with_basic_str(self): | ||
""" | ||
Test basic string | ||
""" | ||
data: str = 'test str' | ||
result = deep_get(data, '') | ||
self.assertEqual(result, 'test str') | ||
|
||
def test_with_str_in_dict(self): | ||
""" | ||
Test basic string inside structure | ||
""" | ||
data: dict = { | ||
'value': 'test str', | ||
} | ||
result = deep_get(data, 'value') | ||
self.assertEqual(result, 'test str') | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains 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