File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -317,10 +317,10 @@ def company(self, company):
317317 >>> user.company = {'id':6, 'name': 'Intercom', 'created_at': 103201}
318318
319319 """
320- if isinstance (company , dict ):
321- self ['companies' ] = [Company (** company )]
322- elif isinstance (company , Company ):
320+ if isinstance (company , Company ):
323321 self ['companies' ] = [company ]
322+ elif isinstance (company , dict ):
323+ self ['companies' ] = [Company (** company )]
324324 else :
325325 raise ValueError ("company must be set as a dict or Company object" )
326326
Original file line number Diff line number Diff line change @@ -162,6 +162,13 @@ def test_company_properties():
162162@raises (ValueError )
163163def test_user_company ():
164164 user = User ()
165+ # use a Company object
166+ user .company = Company ({
167+ 'id' : 1 ,
168+ 'name' : 'Intercom' ,
169+ 'created_at' : datetime .fromtimestamp (1331764344 )
170+ })
171+
165172 # use a dict object
166173 user .company = {
167174 'id' : 1 ,
You can’t perform that action at this time.
0 commit comments