|
|
unit testing, setUp and scoping
Can one use the setUp block to store variables so that they can be
used elsewhere in unit tests? I'm thinking that it's better to have
variables created in another script and have it imported from within
the unit test
#!/usr/bin/env python
'''create knowledge base of strings by unit testing'''
import unittest
class TestPythonStringsTestCase(unittest.TestCase):
def setUp(self):
print '''setting up stuff for ''', __name__
s1 = 'single string'
print dir(str)
def testclass(self):
'''test strings are of class str'''
self.assertEqual(s1.__class__, str)
if __name__ == "__main__":
unittest.main()
--
John Maclean
07739 171 531
MSc (DIC)
Enterprise Linux Systems Engineer
|
|
0
|
|
|
|
Reply
|
john
|
4/14/2010 2:47:31 PM |
|
john maclean a �crit :
> Can one use the setUp block to store variables so that they can be
> used elsewhere in unit tests? I'm thinking that it's better to have
> variables created in another script and have it imported from within
> the unit test
???
>
> #!/usr/bin/env python
> '''create knowledge base of strings by unit testing'''
> import unittest
>
> class TestPythonStringsTestCase(unittest.TestCase):
> def setUp(self):
> print '''setting up stuff for ''', __name__
> s1 = 'single string'
> print dir(str)
>
> def testclass(self):
> '''test strings are of class str'''
> self.assertEqual(s1.__class__, str)
Err... What about FIRST doing the FineTutorial ???
class TestPythonStringsTestCase(unittest.TestCase):
def setUp(self):
self.s1 = 'single string'
def testclass(self):
"test strings are of class str"
self.assert(type(self.s1) is str)
|
|
0
|
|
|
|
Reply
|
Bruno
|
4/14/2010 3:11:26 PM
|
|
|
1 Replies
103 Views
(page loaded in 0.007 seconds)
Similiar Articles: command line arguments in unit/test - comp.lang.ruby... definition, ARGV is showing empty class RunitTest < Test::Unit::TestCase def setup . ... line arguments for a unit-test project Hi, I need to perform unit-testing on ... common email domain suffix - comp.mail.miscOr you can get the admin of the HO server setup aliases for the users at the BO ... Dos and don'ts in C++ unit testing? - comp.lang.c++.moderated ..... dg@steffen a@t ... Testing a midi connection under linux - comp.music.midiThen load in a midi file after the ports setup and see if it plays. You might also ... music.midi Lag time between keypress and sound output - comp.music.midi ... Testing a ... convert data in an OLD CLARION for DOS Operating system - comp ...David -- From David Troxell - Product Scope 7.9 - Encourager Software Email ... Dos and don'ts in C++ unit testing? - comp.lang.c++.moderated ..... alternatives to ... Using fileveent with a Tk GUI : "out of stack space (infinite loop ...| But, for test purposes when there is no unit connected to the RS line, If this is for testing purposes, why ... Independent of my example and going by your reported setup ... Balance point of a solid - comp.soft-sys.math.mathematica ...Dos and don'ts in C++ unit testing? - comp.lang.c++.moderated ... I'm a hobby C++ ... Of Forces - NASA - Home Finding the balance point: Given the following setup below ... PWM as DAC problems - comp.dspHi All, I am using the PWM unit in a PIC18F6720 to ... single quadrant lookup table and after a lot of testing ... do with > the PWM process. > > To confirm this I setup ... USB as standard debug interface - comp.arch.embeddedExample setup: GPIO pin, with LED + resistor attached ... rate generator as my finger slipped off the scope ... and bug hunting... also used to sue then for unit testing. Any experience with Meinberg NTP software on Windows 7? - comp ...... download/ntp/windows/ntp-4.2.4p8@lennon-o-lpv-win32-setup ... But really, I think the Sure Electronics unit was only ... but already it's apparent from my own tests that it's ... transpose help - comp.soft-sys.sas... but the code is simple and you can vary the LAB tests ... lborres,F8.); *LBSTRESN = conversion from raw unit ... I have 2 x 2950-24 switch setup in my office, they're all ... Unit testing - Wikipedia, the free encyclopediaIn computer programming, unit testing is a method by which individual units of source ... still relies heavily on humans testing manually; high-level or global-scope testing ... Unit testing and session/request scope - Spring Community ForumsHello, I have a problem with unit testing ... Forum; Spring Projects; Container; Unit testing and session/request scope ... Before public void setUp ... 7/26/2012 6:37:15 AM
|
|
|
|
|
|
|
|
|