@@ -140,14 +140,25 @@ def test_slice(self):
140140 self .m (hn [1 :], ['John' , 'P.' , 'Doe-Ray' , 'CLU, CFP, LUTC' ,'' ], hn )
141141 self .m (hn [1 :- 2 ], ['John' , 'P.' , 'Doe-Ray' ], hn )
142142
143- def test_dictionary_like (self ):
143+ def test_getitem (self ):
144144 hn = HumanName ("Dr. John A. Kenneth Doe, Jr." )
145145 self .m (hn ['title' ], "Dr." , hn )
146146 self .m (hn ['first' ], "John" , hn )
147147 self .m (hn ['last' ], "Doe" , hn )
148148 self .m (hn ['middle' ], "A. Kenneth" , hn )
149149 self .m (hn ['suffix' ], "Jr." , hn )
150150
151+ def test_setitem (self ):
152+ hn = HumanName ("Dr. John A. Kenneth Doe, Jr." )
153+ hn ['title' ] = 'test'
154+ self .m (hn ['title' ], "test" , hn )
155+ hn ['last' ] = ['test' ,'test2' ]
156+ self .m (hn ['last' ], "test test2" , hn )
157+ with self .assertRaises (TypeError ):
158+ hn ["suffix" ] = [['test' ]]
159+ with self .assertRaises (TypeError ):
160+ hn ["suffix" ] = {"test" :"test" }
161+
151162 def test_conjunction_names (self ):
152163 hn = HumanName ("johnny y" )
153164 self .m (hn .first , "johnny" , hn )
0 commit comments