Okay,

Thanks that worked. 

I still needed to import the Decimal class and I'm not sure that is okay. The 
reason why is I'm receiving the Decimal value from another program, if I 
already know that the value will be a Decimal why test it?

Perhaps I'm getting to caught up in this test-driven development thing.

Cheers,

T


-------- Original-Nachricht --------
> Datum: Tue, 14 Jul 2009 15:45:18 +0200
> Von: "A.T.Hofkamp" <[email protected]>
> An: Todd Matsumoto <[email protected]>
> CC: "[email protected]" <[email protected]>
> Betreff: Re: [Tutor] unittests, testing a type

> Todd Matsumoto wrote:
> > Hi,
> > 
> > Does anyone know how to do a unittest assert for a type? 
> > 
> > So If you have a program returning a Decimal, lets say Decimal("1"), and
> you want to make sure that what is returned is a Decimal object.
> > 
> > At first I thought of importing Decimal and making my own Decimal("1")
> and
> doing an assertEquals, but this implies I know what the return type is
> before
> getting it.
> 
> 
> For new-style classes, you should be able to do
> 
> 
> type(result) is Decimal
> 
> 
> 
> (since the class is a singleton, 'is' should work).
> 
> 
> Albert

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to