Hello All,
I have been trying to write a test framework for a pretty simple command server
application in python. I have not been able to figure out how to test the
socket server.
I would really appreciate if you could help me out in testing this application
using unittest. I'm new to this.
Ple
On Fri, Jan 3, 2014 at 9:53 AM, Roy Smith wrote:
> We've got a test that's been running fine ever since it was written a
> month or so ago. Now, it's failing intermittently on our CI (continuous
> integration) box, so I took a look.
I recommend you solve these problems the way these folks did:
But, the win is that while looking at the code to
figure out why this was failing, I noticed a completely unrelated bug in
the production code.
See, unit testing helps find bugs :-)
--
https://mail.python.org/mailman/listinfo/python-list
On 12/10/2013 9:24 PM, Tim Chase wrote:
I've got some code that kicks off a background request to a remote
server over an SSL connection using client-side certificates. Since
the request is made from a separate thread, I'm having trouble testing
that everything is working without without spinnin
I've got some code that kicks off a background request to a remote
server over an SSL connection using client-side certificates. Since
the request is made from a separate thread, I'm having trouble testing
that everything is working without without spinning up an out-of-band
mock server and actual
On 10/3/2012 5:33 AM, Oscar Benjamin wrote:
On 3 October 2012 02:20, Steven D'Aprano
wrote:
But surely, regardless of where that functionality is defined, you still
need to test that both D1 and D2 exhibit the correct behaviour? Otherwise
D2 (say) may break that functionality and your tests wo
On 3 October 2012 02:20, Steven D'Aprano
wrote:
>
> But surely, regardless of where that functionality is defined, you still
> need to test that both D1 and D2 exhibit the correct behaviour? Otherwise
> D2 (say) may break that functionality and your tests won't notice.
>
> Given a class hierarchy
On Wed, 03 Oct 2012 08:30:19 +1000, Ben Finney wrote:
> Ulrich Eckhardt writes:
>
>> I want test_base() to be run as part of both TestD1 and TestD2, because
>> it tests basic functions provided by both classes D1 and D2.
>
> It sounds, from your description so far, that you have identified a
>
In article ,
Peter Otten <__pete...@web.de> wrote:
> >> Another is to remove it from the global namespace with
> >>
> >> del TestBase
When I had this problem, that's the solution I used.
--
http://mail.python.org/mailman/listinfo/python-list
Ulrich Eckhardt writes:
> I want test_base() to be run as part of both TestD1 and TestD2,
> because it tests basic functions provided by both classes D1 and D2.
It sounds, from your description so far, that you have identified a
design flaw in D1 and D2.
The common functionality should be moved
On 02/10/2012 19:06, Demian Brecht wrote:
Am I missing something? Is there something that wasn't answered by my reply
about using mixins?
from unittest import TestCase
class SharedTestMixin(object):
def test_shared(self):
self.assertNotEquals('foo', 'bar')
class TestA(TestCase, S
Am I missing something? Is there something that wasn't answered by my reply
about using mixins?
from unittest import TestCase
class SharedTestMixin(object):
def test_shared(self):
self.assertNotEquals('foo', 'bar')
class TestA(TestCase, SharedTestMixin):
def test_a(self):
Am I missing something? Is there something that wasn't answered by my reply
about using mixins?
from unittest import TestCase
class SharedTestMixin(object):
def test_shared(self):
self.assertNotEquals('foo', 'bar')
class TestA(TestCase, SharedTestMixin):
def test_a(self):
Fayaz Yusuf Khan wrote:
> Peter Otten wrote:
>
>> Ulrich Eckhardt wrote:
>>> The problem here is that TestBase is not a complete test case (just
> as
>>> class Base is not complete), but the unittest framework will still
> try
>>> to run it on its own.
> How exactly are you invoking the test runn
Ulrich Eckhardt wrote:
> Am 02.10.2012 16:06, schrieb Thomas Bach:
>> On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote:
>>> As you see, the code for test_base() is redundant, so the idea is to
>>> move it to a baseclass:
>>>
>>> class TestBase(unittest.TestCase):
>>> def test_b
Am 02.10.2012 16:06, schrieb Thomas Bach:
On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote:
As you see, the code for test_base() is redundant, so the idea is to
move it to a baseclass:
class TestBase(unittest.TestCase):
def test_base(self):
...
class TestD1(TestBas
Am 02.10.2012 16:06, schrieb Thomas Bach:
On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote:
As you see, the code for test_base() is redundant, so the idea is to
move it to a baseclass:
class TestBase(unittest.TestCase):
def test_base(self):
...
class TestD1(TestBas
Peter Otten wrote:
> Ulrich Eckhardt wrote:
>> The problem here is that TestBase is not a complete test case (just
as
>> class Base is not complete), but the unittest framework will still
try
>> to run it on its own.
How exactly are you invoking the test runner? unittest? nose? You can
tell the
Ulrich Eckhardt wrote:
> As you see, the code for test_base() is redundant, so the idea is to
> move it to a baseclass:
>
> class TestBase(unittest.TestCase):
> def test_base(self):
> ...
>
> class TestD1(TestBase):
> def test_r(self):
> ...
> def test_s(self):
>
On Tue, Oct 02, 2012 at 02:27:11PM +0200, Ulrich Eckhardt wrote:
> As you see, the code for test_base() is redundant, so the idea is to
> move it to a baseclass:
>
> class TestBase(unittest.TestCase):
> def test_base(self):
> ...
>
> class TestD1(TestBase):
> def test_r(self):
>
[1] in C++ I would call that a "mixin"
Mixins are perfectly valid Python constructs as well and are perfectly
valid (imho) for this use case.
On a side note, I usually append a "Mixin" suffix to my mixin classes in
order to make it obvious to the reader.
--
Demian Brecht
@demianbrecht
ht
Greetings!
I'm trying to unittest a class hierachy using Python 2.7. I have a
common baseclass Base and derived classes D1 and D2 that I want to test.
The baseclass in not instantiatable on its own. Now, the first approach
is to have test cases TestD1 and TestD2, both derived from class TestCa
In article ,
Tycho Andersen wrote:
> While I agree there's a lot of things you can't control for, you can
> get a more accurate picture by using CPU time instead of wall time
> (e.g. the clock() system call). If what you care about is mostly CPU
> time [...]
That's a big if. In some cases, CPU
On Nov 17, 4:03 pm, Roy Smith wrote:
> In article ,
> Ulrich Eckhardt wrote:
>
> > Yes, this is surely something that is necessary, in particular since
> > there are no clear success/failure outputs like for unit tests and they
> > require a human to interpret them.
>
> As much as possible, you
; >
> > What I'd just like to ask is how you do such things. Are there tools
> > available that help? I was considering using the unit testing framework,
> > but the problem with that is that the results are too hard to interpret
> > programmatically and too easy t
In article ,
Ulrich Eckhardt wrote:
> Yes, this is surely something that is necessary, in particular since
> there are no clear success/failure outputs like for unit tests and they
> require a human to interpret them.
As much as possible, you want to automate things so no human
intervention
standard deviation. Some of this is similar to unit testing (code to set
up/tear down), but other things are too different. Also, sometimes I can
vary tests with a factor F, then I would also want to capture the
influence of this factor. I would even wonder if you can't verify the
behav
r to unit-tests, only that they are
> much more fuzzy and obviously dependent on the systems involved, CPU
> load, network load, day of the week (Tuesday is virus scan day) etc.
>
> What I'd just like to ask is how you do such things. Are there tools
> available that
load, network load, day of the week (Tuesday is virus scan day) etc.
What I'd just like to ask is how you do such things. Are there tools
available that help? I was considering using the unit testing framework,
but the problem with that is that the results are too hard to interpret
progra
In article ,
Ian Kelly wrote:
> This would work:
>
> self.assertRaises(TypeError, lambda: self.testListNone[:1])
If you're using the version of unittest from python 2.7, there's an even
nicer way to write this:
with self.assertRaises(TypeError):
self.testListNone[:1]
--
http://mail.pyth
On Mon, May 23, 2011 at 4:30 PM, Andrius wrote:
> and I am expecting test to pass, but I am getting exception:
> Traceback (most recent call last):
> self.assertRaises(TypeError, self.testListNone[:1])
> TypeError: 'NoneType' object is unsubscriptable
>
> I thought that assertRaises will pass s
That was quick! Thanks Ian
On 23 May 2011 23:46, Ian Kelly wrote:
> On Mon, May 23, 2011 at 4:30 PM, Andrius wrote:
> > and I am expecting test to pass, but I am getting exception:
> > Traceback (most recent call last):
> >self.assertRaises(TypeError, self.testListNone[:1])
> > TypeError:
Hello,
would be gratefull for the explonation.
I did a simple test case:
def setUp(self):
self.testListNone = None
def testListSlicing(self):
self.assertRaises(TypeError, self.testListNone[:1])
and I am expecting test to pass, but I am getting exception:
Traceback (most recent call last):
Il Thu, 17 Feb 2011 18:31:59 -0500, Matt Chaput ha scritto:
>
> The problem is that with both "python setup.py tests" and "nosetests",
> Maybe multiprocessing is starting new Windows processes by copying the
> command line of the current process? But if the command line is
> "nosetests", it's
On 17/02/2011 8:22 PM, phi...@semanchuk.com wrote:
Hi Matt,
I assume you're aware of this documentation, especially the item
entitled "Safe importing of main module"?
http://docs.python.org/release/2.6.6/library/multiprocessing.html#windows
Yes, but the thing is my code isn't __main__, my uni
On 18/02/2011 2:54 AM, Terry Reedy wrote:
On 2/17/2011 6:31 PM, Matt Chaput wrote:
Does anyone know the "right" way to write a unit test for code that uses
multiprocessing on Windows?
I would start with Lib/test/test_multiprocessing.
Good idea, but on the one hand it doesn't seem to be doing
On 2/17/2011 6:31 PM, Matt Chaput wrote:
Does anyone know the "right" way to write a unit test for code that uses
multiprocessing on Windows?
I would start with Lib/test/test_multiprocessing.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
Quoting Matt Chaput :
Does anyone know the "right" way to write a unit test for code that
uses multiprocessing on Windows?
The problem is that with both "python setup.py tests" and
"nosetests", when they get to testing any code that starts Processes
they spawn multiple copies of the testi
Does anyone know the "right" way to write a unit test for code that uses
multiprocessing on Windows?
The problem is that with both "python setup.py tests" and "nosetests",
when they get to a multiprocessing test they spawn multiple copies of
the testing suite. The test runner in PyDev works pr
Does anyone know the "right" way to write a unit test for code that uses
multiprocessing on Windows?
The problem is that with both "python setup.py tests" and "nosetests",
when they get to testing any code that starts Processes they spawn
multiple copies of the testing suite (i.e. the new proc
Hello!
Two things are missing from the web server I've been developing before
I can release 1.0: unit tests and documentation. Documentation being
entirely my problem, I've run into a bit of a snag with unit testing;
just how would you go about it?
Specifically, I need to test t
On 4/14/2010 11:19 AM, J. Cliff Dyer wrote:
On Wed, 2010-04-14 at 15:51 +0100, john maclean wrote:
self.assertEqual(platform.__builtins__.__class__, dict,
"platform.__class__ supposed to be dict")
self.assertEqual(platform.__name__, 'platform' )
The preferred spelling for:
platform.__bui
On 14 April 2010 16:22, Francisco Souza wrote:
>> On Wed, Apr 14, 2010 at 11:47 AM, john maclean wrote:
>> 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 i
>
> On Wed, Apr 14, 2010 at 11:47 AM, john maclean wrote:
> 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
>
Hi John,
ea
On Wed, 2010-04-14 at 15:51 +0100, john maclean wrote:
> self.assertEqual(platform.__builtins__.__class__, dict,
> "platform.__class__ supposed to be dict")
> self.assertEqual(platform.__name__, 'platform' )
The preferred spelling for:
platform.__builtins__.__class__
would be
type(pla
x27;create knowledge base of strings by unit testing'''
import unittest
class TestPythonStringsTestCase(unittest.TestCase):
def setUp(self):
print '''setting up stuff for ''', __name__
s1 =
On 14 April 2010 09:09, Gabriel Genellina wrote:
> En Tue, 13 Apr 2010 11:01:19 -0300, John Maclean
> escribió:
>
>> Is there an error in my syntax? Why is my test failing? Line 16.
>>
>> ==
>> FAIL: platform.__builtins__.blah
>>
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 o
En Tue, 13 Apr 2010 11:01:19 -0300, John Maclean
escribió:
Is there an error in my syntax? Why is my test failing? Line 16.
==
FAIL: platform.__builtins__.blah
se languages unit testing framework to get a better
> understanding of how a language works. Right now I want to grok the
> platform module;
>
>
> 1 #!/usr/bin/env python
> 2 '''a pythonic factor'''
> 3 import unittest
> 4 import platfo
John Maclean wrote:
I normally use languages unit testing framework to get a better
understanding of how a language works. Right now I want to grok the
platform module;
1 #!/usr/bin/env python
2 '''a pythonic factor'''
3 import unittest
4
On 04/13/10 15:01, John Maclean wrote:
I normally use languages unit testing framework to get a better
understanding of how a language works. Right now I want to grok the
platform module;
1 #!/usr/bin/env python
2 '''a pythonic factor'''
3 import unit
On Tue, Apr 13, 2010 at 10:01 AM, John Maclean wrote:
> I normally use languages unit testing framework to get a better
> understanding of how a language works. Right now I want to grok the
> platform module;
>
>
> 1 #!/usr/bin/env python
> 2 '''a pythonic
I normally use languages unit testing framework to get a better
understanding of how a language works. Right now I want to grok the
platform module;
1 #!/usr/bin/env python
2 '''a pythonic factor'''
3 import unittest
4 import platform
5
6 class TestPyfa
commander_coder a écrit :
Hello,
I have a routine that sends an email (this is how a Django view
notifies me that an event has happened). I want to unit test that
routine.
http://docs.djangoproject.com/en/dev/topics/email/#e-mail-backends
Or if you're stuck with 1.x < 1.2a, you could just
commander_coder wrote:
> I have a routine that sends an email (this is how a Django view
> notifies me that an event has happened). I want to unit test that
> routine.
Are you opening SMTP and POP3 sockets??
If you are not developing that layer itself, just use Django's built-
in mock system. H
Bruno, I talked to someone who explained to me how what you said
gives a way around my difficulty. Please ignore the other reply.
I'll do what you said. Thank you; I appreciate your help.
Jim
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 18, 10:27 am, Bruno Desthuilliers wrote:
> you could just mock the send_mail
> function to test that your app does send the appropriate mail - which is
> what you really want to know.
That's essentially what I think I am doing.
I need to send a relatively complex email, multipart, with b
On Feb 18, 9:55 am, Roy Smith wrote:
> Just a wild guess here, but maybe there's some DNS server which
> round-robins three address records for some hostname you're using, one of
> which is bogus.
>
> I've seen that before, and this smells like the right symptoms.
Everything happens on my laptop,
In article
,
commander_coder wrote:
> The real puzzler for me is that the test reliably fails every third
> time. For instance, if I try it six times then it succeeds the first,
> second, fourth, and fifth times. I have to say that I cannot
> understand this at all but it certainly makes the
Hello,
I have a routine that sends an email (this is how a Django view
notifies me that an event has happened). I want to unit test that
routine. So I gave each mail a unique subject line and I want to use
python's mailbox package to look for that subject. But sometimes the
mail gets delivered
On May 23, 2:00 pm, pigmart...@gmail.com wrote:
> Hi,
>
> I'm working on a unit test framework for a module. The module I'm
> testing indirectly calls another module which is expensive to access
> --- CDLLs whose functions access a database.
>
> test_MyModule --->MyModule--->IntermediateModule
Try
import sys
import ExpensiveModuleStub
sys.modules['ExpensiveModule'] = ExpensiveModuleStub
sys.modules['ExpensiveModule'].__name__ = 'ExpensiveModule'
Should do the trick
--
Vyacheslav
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 24 May 2009 13:14:30 +0100, A. Cavallo wrote:
> how about the old and simple:
>
> import ExpensiveModuleStub as ExpensiveModule
No, that won't do, because for it to have the desired effort, it needs to
be inside the IntermediateModule, not the Test_Module. That means that
IntermediateM
how about the old and simple:
import ExpensiveModuleStub as ExpensiveModule
On a different league you could make use of decorator and creating caching
objects but that depends entirely on the requirements (how strict your test
must be, test data sizes involved and more, much more details).
Rega
pigmart...@gmail.com writes:
>
> import ExpensiveModuleStub
> sys.modules['ExpensiveModule'] = ExpensiveModuleStub # Doesn't
> work
>
> But, import statements in the IntermediateModule still access the real
> ExpensiveModule, not the stub.
>
> The examples I can find of creating and usi
On Sat, 23 May 2009 06:00:15 -0700, pigmartian wrote:
> Hi,
>
> I'm working on a unit test framework for a module. The module I'm
> testing indirectly calls another module which is expensive to access ---
> CDLLs whose functions access a database.
...
> The examples I can find of creating and us
Hi,
I'm working on a unit test framework for a module. The module I'm
testing indirectly calls another module which is expensive to access
--- CDLLs whose functions access a database.
test_MyModule --->MyModule--->IntermediateModule---
>ExpensiveModule
I want to create a stub of ExpensiveMo
Hi,
I'm work on a testing framework for Python. Until now I have
implemented the main features of PyUnit and JUnit 4.x. I like the
annotation syntax of JUnit 4.x and it's theory concept is great
therefore you can imagine how my framework will be.
I plan a lot of additionally features which are n
> sorry for not reporting a bug - i assumed you'd know (and the workarounds
> described above meant i wasn't stalled).
>
> i also have eclipse 3.4.2 with pydev 1.4.4.2636 on a separate machine (ie
> new versions), and i can try there if you want (it will take a while to
> get the source there, but
In unittest, has anyone used the *NIX command "find" to automatically
build a test suite file of all tests under a specified directory?
I generally name my tests as _Test_ORIGINAL_MODULE_NAME.py where
ORIGINAL_MODULE_NAME is the obvious value. This way, I can include/
exclude them from deployments
copy+paste error; the correct Python2.6 details are:
Python 2.6 (r26:66714, Feb 3 2009, 20:49:49)
andrew cooke wrote:
> this is with a homebuilt 3.0 - Python 3.0 (r30:67503, Jan 16 2009,
> 06:50:19) and opensuse's default 2.6 - Python 3.0 (r30:67503, Jan 16 2009,
> 06:50:19) - on Eclipse 3.3.2
Fabio Zadrozny wrote:
>> not exactly a framework, but useful while working on small projects -
>> you
>> can run tests from inside eclipse (using the pydev plugin for python).
>> it's easy to run all tests or some small subset (although it is a bit
>> buggy for 3.0).
>
> What exactly is not working
Hi Andew,
> not exactly a framework, but useful while working on small projects - you
> can run tests from inside eclipse (using the pydev plugin for python).
> it's easy to run all tests or some small subset (although it is a bit
> buggy for 3.0).
What exactly is not working with 3.0? (couldn't
En Tue, 24 Mar 2009 09:06:47 -0300, escribió:
I am looking for a unit testing framework for Python. I am aware of
nose, but was wondering if there are any others that will
automatically find and run all tests under a directory hierarchy.
All known testing tools (and some unknown too):
http
On Mar 24, 8:06 am, grkunt...@gmail.com wrote:
> I am looking for a unit testing framework for Python. I am aware of
> nose, but was wondering if there are any others that will
> automatically find and run all tests under a directory hierarchy.
>
> Thanks, Ralph
*Nose
*Trial
*
On Tue, Mar 24, 2009 at 8:06 AM, wrote:
> I am looking for a unit testing framework for Python. I am aware of
> nose, but was wondering if there are any others that will
> automatically find and run all tests under a directory hierarchy.
Have you already looked at the unittest module?
grkunt...@gmail.com wrote:
> I am looking for a unit testing framework for Python. I am aware of
> nose, but was wondering if there are any others that will
> automatically find and run all tests under a directory hierarchy.
not exactly a framework, but useful while working on small
On Tue, 24 Mar 2009 05:06:47 -0700 (PDT), grkunt...@gmail.com wrote:
I am looking for a unit testing framework for Python. I am aware of
nose, but was wondering if there are any others that will
automatically find and run all tests under a directory hierarchy.
One such tool is trial, http
I am looking for a unit testing framework for Python. I am aware of
nose, but was wondering if there are any others that will
automatically find and run all tests under a directory hierarchy.
Thanks, Ralph
--
http://mail.python.org/mailman/listinfo/python-list
On 27 Nov, 16:32, "Emanuele D'Arrigo" <[EMAIL PROTECTED]> wrote:
> On Nov 27, 5:00 am, Steven D'Aprano
>
> <[EMAIL PROTECTED]> wrote:
> > Refactor until your code is simple enough to unit-test effectively, then
> > unit-test effectively.
>
> Ok, I've taken this wise suggestion on board and of cours
Steven D'Aprano schreef:
[..]
Thank you for elaborate answer, Steven. I think I'm really starting to
get it now.
--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
-- Isaac Asimov
Roel Schroeven
--
http://mail.python.org/mailman/l
Steven D'Aprano wrote:
On Sun, 30 Nov 2008 03:42:50 +, Steven D'Aprano wrote:
def lcm(a, b):
return a/gcd(a, b)*b
(By the way: there's a subtle bug in lcm() that will hit you in Python
3. Can you spot it?
Er, ignore this. Division in Python 3 only returns a float if the
remainder i
On Sun, 30 Nov 2008 03:42:50 +, Steven D'Aprano wrote:
> def lcm(a, b):
> return a/gcd(a, b)*b
>
> (By the way: there's a subtle bug in lcm() that will hit you in Python
3. Can you spot it?
Er, ignore this. Division in Python 3 only returns a float if the
remainder is non-zero, and whe
On Sat, 29 Nov 2008 17:13:00 +0100, Roel Schroeven wrote:
> Except that I'm always told that the goal of unit tests, at least
> partly, is to protect us agains mistakes when we make changes to the
> tested functions. They should tell me wether I can still trust spam()
> after refactoring it. Doesn
Thanks for your answer. I still don't understand completely though. I
suppose it's me, but I've been trying to understand some of this for
quite some and somehow I can't seem to wrap my head around it.
Steven D'Aprano schreef:
On Sat, 29 Nov 2008 11:36:56 +0100, Roel Schroeven wrote:
The firs
On Nov 29, 3:33 am, "Emanuele D'Arrigo" <[EMAIL PROTECTED]> wrote:
> On Nov 29, 12:35 am, Fuzzyman <[EMAIL PROTECTED]> wrote:
>
> > Your experiences are one of the reasons that writing the tests *first*
> > can be so helpful. You think about the *behaviour* you want from your
> > units and you test
nd not every possible
>> combination of paths.
>
> I don't understand that. This is part of something I've never understood
> about unit testing, and each time I try to apply unit testing I bump up
> against, and don't know how to resolve. I find it also difficult to
>
thing I've never understood
about unit testing, and each time I try to apply unit testing I bump up
against, and don't know how to resolve. I find it also difficult to
explain exactly what I mean.
Suppose I need to write method spam() that turns out to be somewhat
complex, like t
On Nov 29, 12:35 am, Fuzzyman <[EMAIL PROTECTED]> wrote:
> Your experiences are one of the reasons that writing the tests *first*
> can be so helpful. You think about the *behaviour* you want from your
> units and you test for that behaviour - *then* you write the code
> until the tests pass.
Than
Thank you to everybody who has replied about the original problem. I
eventually refactored the whole (monster) method over various smaller
and simpler ones and I'm now testing each individually. Things have
gotten much more tractable. =)
Thank you for nudging me in the right direction! =)
Manu
--
On Nov 27, 4:32 pm, "Emanuele D'Arrigo" <[EMAIL PROTECTED]> wrote:
> On Nov 27, 5:00 am, Steven D'Aprano
>
> <[EMAIL PROTECTED]> wrote:
> > Refactor until your code is simple enough to unit-test effectively, then
> > unit-test effectively.
>
> Ok, I've taken this wise suggestion on board and of cou
[EMAIL PROTECTED] wrote:
Terry Reedy:
A 'function' only needs to be nested if it is intended to be
different (different default or closure) for each execution of its
def.<
Or maybe because you want to denote a logical nesting, or maybe
because you want to keep the outer namespace cleaner,
In article <[EMAIL PROTECTED]>,
Nigel Rantor <[EMAIL PROTECTED]> wrote:
> Roy Smith wrote:
> >
> > There's a well known theory in studies of the human brain which says people
> > are capable of processing about 7 +/- 2 pieces of information at once.
>
> It's not about processing multiple tak
Steven D'Aprano a écrit :
(snip)
Consequently, I almost always use single-underscore "private by
convention" names, rather than double-underscore names. The name-mangling
is, in my experience, just a nuisance.
s/just/most often than not/ and we'll agree on this !-)
--
http://mail.python.org/m
Roy Smith wrote:
There's a well known theory in studies of the human brain which says people
are capable of processing about 7 +/- 2 pieces of information at once.
It's not about processing multiple taks, it's about the amount of things
that can be held in working memory.
n
--
http://
On Fri, 28 Nov 2008 00:06:01 -0800, bearophileHUGS wrote:
>>For this to change wouldn't be a little change, it would be a large
>>change.<
>
> I see, then my proposal has little hope, I presume. I'll have to keep
> moving functions outside to test them and move them inside again when I
> want to
Terry Reedy:
>The problem is that inner functions do not exist until the outer function is
>called and the inner def is executed. And they cease to exist when the outer
>function returns unless returned or associated with a global name or
>collection.<
OK.
>A 'function' only needs to be nes
On Thu, 27 Nov 2008 08:32:12 -0800, Emanuele D'Arrigo wrote:
> On Nov 27, 5:00 am, Steven D'Aprano
> <[EMAIL PROTECTED]> wrote:
>> Refactor until your code is simple enough to unit-test effectively,
>> then unit-test effectively.
>
> Ok, I've taken this wise suggestion on board and of course I fo
function is called, and when the outer function is called they
go out of scope and cease to exist. For this to change wouldn't be a
little change, it would be a large change.
I can see benefit to the idea. Unit testing, as you say. I also like the
idea of doing this:
def foo(x
1 - 100 of 289 matches
Mail list logo