Skip to content
Snippets Groups Projects
Commit 09b25f76 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

minor doc changes

parent 307e8043
No related branches found
No related tags found
No related merge requests found
# v2.23.2 # v2.23.2
\ No newline at end of file
* minor changes to DictObject's documentation
...@@ -10,6 +10,8 @@ class DictObject(dict): ...@@ -10,6 +10,8 @@ class DictObject(dict):
""" """
A dictionary wrapper that can be accessed by attributes. A dictionary wrapper that can be accessed by attributes.
Note that it still remains a completely valid dictionary!
You can use keys different than strings, but they will be inaccessible as attributes, and You can use keys different than strings, but they will be inaccessible as attributes, and
you will have to do subscription to get them. you will have to do subscription to get them.
...@@ -17,6 +19,7 @@ class DictObject(dict): ...@@ -17,6 +19,7 @@ class DictObject(dict):
>>> a = DictObject({'test': 5}) >>> a = DictObject({'test': 5})
>>> self.assertEqual(a.test, 5) >>> self.assertEqual(a.test, 5)
>>> self.assertEqual(a['test'], 5)
""" """
def __copy__(self): def __copy__(self):
......
...@@ -497,8 +497,11 @@ class TestStructures(unittest.TestCase): ...@@ -497,8 +497,11 @@ class TestStructures(unittest.TestCase):
b = DictObject(a) b = DictObject(a)
b.c = 4 b.c = 4
self.assertEqual(b.a, 5) self.assertEqual(b.a, 5)
self.assertEqual(b['a'], 5)
self.assertEqual(b.k, 3) self.assertEqual(b.k, 3)
self.assertEqual(b['k'], 3)
self.assertEqual(b.c, 4) self.assertEqual(b.c, 4)
self.assertEqual(b['c'], 4)
self.assertIn('DictObject', str(b)) self.assertIn('DictObject', str(b))
self.assertIn('DictObject', repr(b)) self.assertIn('DictObject', repr(b))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment