forked from fabiocaccamo/python-benedict
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent clearing dict instance when assigning value to itself. fabioc…
- Loading branch information
1 parent
18629ba
commit 9800f21
Showing
2 changed files
with
23 additions
and
0 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
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,20 @@ | ||
import unittest | ||
|
||
from benedict import benedict | ||
|
||
|
||
class github_issue_0294_test_case(unittest.TestCase): | ||
""" | ||
This class describes a github issue 0294 test case. | ||
https://github.com/fabiocaccamo/python-benedict/issues/294 | ||
To run this specific test: | ||
- Run python -m unittest tests.github.test_issue_0294 | ||
""" | ||
|
||
def test_assigning_benedict_element_to_itself_clears_the_element(self): | ||
d = benedict({"a": {"b": 1}}) | ||
d["a"] = d["a"] | ||
self.assertEqual(d, {"a": {"b": 1}}) | ||
d.a = d.a | ||
self.assertEqual(d, {"a": {"b": 1}}) |