Re: [Tutor] unittest difficulty

2017-07-19 Thread Japhy Bartlett
Is `0.0` the troublesome float here? On Wed, Jul 19, 2017 at 7:35 AM, Shall, Sydney wrote: > I am learning to use unittest. > > I have written a program that runs as it should. > 247 tests give me a satisfactory answer. > > I have now added one more test and I get an error which I do not > un

[Tutor] unittest difficulty

2017-07-19 Thread Shall, Sydney
I am learning to use unittest. I have written a program that runs as it should. 247 tests give me a satisfactory answer. I have now added one more test and I get an error which I do not understand. The two relevant tests are: def test_type_capitalsadvanced(self): self.assertEqual(type

Re: [Tutor] unittest not working

2015-11-19 Thread Dave P
On Thu, Nov 19, 2015 at 8:25 AM, Mike wrote: > I'm trying to unit test a self-built regular expression processor for an > assignment. I'm trying to set up unit tests for the package, but it's not > executing them. This is my first time trying to use the unittest module, so > I'm sure I'm missing

Re: [Tutor] unittest not working

2015-11-19 Thread Oscar Benjamin
On 19 November 2015 at 13:25, Mike wrote: > I'm trying to unit test a self-built regular expression processor for an > assignment. I'm trying to set up unit tests for the package, but it's not > executing them. This is my first time trying to use the unittest module, so > I'm sure I'm missing som

Re: [Tutor] unittest not working

2015-11-19 Thread Peter Otten
Mike wrote: > I'm trying to unit test a self-built regular expression processor for an > assignment. I'm trying to set up unit tests for the package, but it's not > executing them. This is my first time trying to use the unittest module, > so I'm sure I'm missing something, I'm just not sure what

[Tutor] unittest not working

2015-11-19 Thread Mike
I'm trying to unit test a self-built regular expression processor for an assignment. I'm trying to set up unit tests for the package, but it's not executing them. This is my first time trying to use the unittest module, so I'm sure I'm missing something, I'm just not sure what. I even put a test c

Re: [Tutor] unittest with random population data

2015-06-03 Thread Cameron Simpson
[ I've taken this discussion back to the tutor list. - Cameron ] On 01Jun2015 18:14, Sydney Shall wrote: On 31/05/2015 03:00, Cameron Simpson wrote: You say that your results are "all rather close, consistent with the sigma value I have chosen for the spread of my population". I would advocate

Re: [Tutor] unittest with random population data

2015-06-03 Thread Alan Gauld
On 01/06/15 18:14, Sydney Shall wrote: Finally, I have one comment for the respected Moderator, if he is not out on a walk in the highlands in this cold and wet weather. No, that's on tomorrow's schedule :-) I have taken the liberty of raising my problem here rather than elsewhere, because

Re: [Tutor] unittest with random population data

2015-06-02 Thread Sydney Shall
On 31/05/2015 03:00, Cameron Simpson wrote: On 30May2015 12:16, Sydney Shall wrote: Following advice from you generous people, I have chosen a project >that interests me, to develop some knowledge of python. My projest is a simulation of a biological population. I have a base class and a simula

Re: [Tutor] unittest with random population data

2015-06-02 Thread Sydney Shall
On 02/06/2015 07:59, Steven D'Aprano wrote: Please keep your replies on the tutor list, so that others may offer advice, and learn from your questions. Thanks, Steve On Mon, Jun 01, 2015 at 06:03:08PM +0100, Sydney Shall wrote: On 31/05/2015 00:41, Steven D'Aprano wrote: On Sat, May 30, 2015

Re: [Tutor] unittest with random population data

2015-05-30 Thread Cameron Simpson
On 30May2015 12:16, Sydney Shall wrote: Following advice from you generous people, I have chosen a project >that interests me, to develop some knowledge of python. My projest is a simulation of a biological population. I have a base class and a simulation function, which uses instances of the

Re: [Tutor] unittest with random population data

2015-05-30 Thread Steven D'Aprano
On Sat, May 30, 2015 at 12:16:01PM +0100, Sydney Shall wrote: > I have written a unittest class which works OK. > But the problem I have is that because I use the random module to > populate my initial arrays, my data is not strictly predictable even > though I am using seed(0). Please show us

Re: [Tutor] unittest with random population data

2015-05-30 Thread Laura Creighton
In a message of Sat, 30 May 2015 12:16:01 +0100, Sydney Shall writes: >MAC OSX 10.10.3 >Enthought Python 2.7 > >I am an almost beginner. > >Following advice from you generous people, I have chosen a project that >interests me, to develop some knowledge of python. >My projest is a simulation of a b

Re: [Tutor] unittest with random population data

2015-05-30 Thread Peter Otten
Sydney Shall wrote: > MAC OSX 10.10.3 > Enthought Python 2.7 > > I am an almost beginner. > > Following advice from you generous people, I have chosen a project that > interests me, to develop some knowledge of python. > My projest is a simulation of a biological population. > I have a base clas

[Tutor] unittest with random population data

2015-05-30 Thread Sydney Shall
MAC OSX 10.10.3 Enthought Python 2.7 I am an almost beginner. Following advice from you generous people, I have chosen a project that interests me, to develop some knowledge of python. My projest is a simulation of a biological population. I have a base class and a simulation function, which u

Re: [Tutor] unittest for: Raises an exception

2015-02-19 Thread Sydney Shall
On 18/02/2015 20:40, Ben Finney wrote: Sydney Shall writes: My test code is the following: def test_func_getSurplusLabourTime_Exc(self): self.assertRaises(ValueError,self.cwp.getSurplusLabourTime(self.cwp.ww,self.cwp.uvc)) [This last line should indented, but it refuses to do so!] What is

Re: [Tutor] unittest for: Raises an exception

2015-02-18 Thread Ben Finney
Sydney Shall writes: > My test code is the following: > > def test_func_getSurplusLabourTime_Exc(self): > > self.assertRaises(ValueError,self.cwp.getSurplusLabourTime(self.cwp.ww,self.cwp.uvc)) > > > [This last line should indented, but it refuses to do so!] What is “it” which refuses to inden

Re: [Tutor] unittest for: Raises an exception

2015-02-18 Thread Raúl Cumplido
Hi, When using self.assertRaises like this you should pass a callable (the function you are going to call), but not call the function on the test. The problem is when the function takes arguments. At this point you need to create a callable with the two arguments. That can be done with functools b

[Tutor] unittest for: Raises an exception

2015-02-18 Thread Sydney Shall
I use a MAC OSX 10.9.5 Enthought Canopy Python 2.7.6 I am a learner. I am now trying to learn unittests as is often emphasised on this list. I think that I have understood the simple unit tests such as Equal, Greater etc. But I am struggling with the syntax of a test for Raises an exception.

Re: [Tutor] unittest decorators

2014-04-04 Thread Albert-Jan Roskam
> From: Peter Otten <__pete...@web.de> >To: tutor@python.org >Sent: Thursday, April 3, 2014 3:13 PM >Subject: Re: [Tutor] unittest decorators > > >Albert-Jan Roskam wrote: > >> The unittest module has some really han

Re: [Tutor] unittest decorators

2014-04-03 Thread Peter Otten
Albert-Jan Roskam wrote: > The unittest module has some really handy decorators: @unittest.skip > and @unittest.skipIf. I use the former for temporary TODO or FIXME things, > but I use the latter for a more permanent thing: > @unittest.skipif(sys.version_info()[0] > 2). Yet, in the test summary yo

[Tutor] unittest decorators

2014-04-02 Thread Albert-Jan Roskam
Hi,   The unittest module has some really handy decorators: @unittest.skip and @unittest.skipIf. I use the former for temporary TODO or FIXME things, but I use the latter for a more permanent thing: @unittest.skipif(sys.version_info()[0] > 2). Yet, in the test summary you just see error, skipped

Re: [Tutor] unittest skipping tests

2013-08-01 Thread Alan Gauld
On 01/08/13 14:22, Matthew Ngaha wrote: Thanks guys. i was following some examples and noticed it. I tried to use it in my program and the same thing happened. In this example, there are 6 tests, and only 4 run. http://bpaste.net/show/abLNTHU49w1j2M8Fey8X/ You're still just teasing us. You sho

Re: [Tutor] unittest skipping tests

2013-08-01 Thread Walter Prins
Hi, On 1 August 2013 14:22, Matthew Ngaha wrote: > Thanks guys. i was following some examples and noticed it. I tried to > use it in my program and the same thing happened. In this example, > there are 6 tests, and only 4 run. > > http://bpaste.net/show/abLNTHU49w1j2M8Fey8X/ > The reason that 2

Re: [Tutor] unittest skipping tests

2013-08-01 Thread Walter Prins
Hi, On 1 August 2013 13:11, Matthew Ngaha wrote: > im trying to do some unittesting and i've written 1 class with 4 test > methods and it skips 2 of these methods for no reason. If i comment > out the 2 it doesn't skip, it will now test the 2 it previously > skipped. Is this the default behaviou

Re: [Tutor] unittest skipping tests

2013-08-01 Thread Alan Gauld
On 01/08/13 13:11, Matthew Ngaha wrote: im trying to do some unittesting and i've written 1 class with 4 test methods and it skips 2 of these methods for no reason. If i comment out the 2 it doesn't skip, it will now test the 2 it previously skipped. Is this the default behaviour I'm pretty sur

Re: [Tutor] unittest + tkinter

2010-11-02 Thread Alan Gauld
"Wayne Werner" wrote I'm trying my hand at test driven development via the unittest module. Since my program is using Tkinter, my thought is that I need to create the main window. The only problem is that when I launch the main loop, further lines of code aren't executed. Thats a feature

[Tutor] unittest + tkinter

2010-11-01 Thread Wayne Werner
I'm sure there's an incredibly simple way to do this, but at the moment it eludes me. I'm trying my hand at test driven development via the unittest module. Since my program is using Tkinter, my thought is that I need to create the main window. The only problem is that when I launch the main loop,

Re: [Tutor] unittest testing order...

2010-09-27 Thread Steven D'Aprano
On Tue, 28 Sep 2010 08:07:30 am Modulok wrote: > On 9/27/10, Steven D'Aprano wrote: > > On Tue, 28 Sep 2010 04:03:17 am Modulok wrote: > >> List, > >> > >> When using the unittest module, tests are run in alphanumeric > >> order. What's the suggested way of specifying a test order? > > > > There i

Re: [Tutor] unittest testing order...

2010-09-27 Thread Steve Willoughby
On 27-Sep-10 15:07, Modulok wrote: In an ideal world, I agree. This is possible for pure functional programming where state is avoided. However, when dealing with object oriented, imperative programming, state changes cannot be avoided. Generally, a unit test should test a single aspect of a si

Re: [Tutor] unittest testing order...

2010-09-27 Thread Modulok
On 9/27/10, Steven D'Aprano wrote: > On Tue, 28 Sep 2010 04:03:17 am Modulok wrote: >> List, >> >> When using the unittest module, tests are run in alphanumeric order. >> What's the suggested way of specifying a test order? > > There isn't one. It shouldn't matter what order the tests run, no test

Re: [Tutor] unittest testing order...

2010-09-27 Thread Evert Rol
>> List, >> >> When using the unittest module, tests are run in alphanumeric order. >> What's the suggested way of specifying a test order? > > There isn't one. It shouldn't matter what order the tests run, no test > should *rely* on another test. > > (Although of course, if one test fails, a

Re: [Tutor] unittest testing order...

2010-09-27 Thread Steven D'Aprano
On Tue, 28 Sep 2010 04:03:17 am Modulok wrote: > List, > > When using the unittest module, tests are run in alphanumeric order. > What's the suggested way of specifying a test order? There isn't one. It shouldn't matter what order the tests run, no test should *rely* on another test. (Although

[Tutor] unittest testing order...

2010-09-27 Thread Modulok
List, When using the unittest module, tests are run in alphanumeric order. What's the suggested way of specifying a test order? Any code examples would be great! Thanks -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscript

Re: [Tutor] unittest

2010-03-04 Thread Steven D'Aprano
On Thu, 4 Mar 2010 05:32:22 pm you wrote: > Steven D'Aprano wrote: > > On Thu, 4 Mar 2010 04:27:23 am C.T. Matsumoto wrote: > >> Hello, > >> > >> Can someone tell me the difference between unittests assertEqual > >> and assertEquals? > > > > assertEqual, assertEquals and failUnless are three spelli

Re: [Tutor] unittest

2010-03-03 Thread C.T. Matsumoto
Steven D'Aprano wrote: On Thu, 4 Mar 2010 04:27:23 am C.T. Matsumoto wrote: Hello, Can someone tell me the difference between unittests assertEqual and assertEquals? assertEqual, assertEquals and failUnless are three spellings for the same thing. There is no difference. Thank

Re: [Tutor] unittest

2010-03-03 Thread Steven D'Aprano
On Thu, 4 Mar 2010 04:27:23 am C.T. Matsumoto wrote: > Hello, > > Can someone tell me the difference between unittests assertEqual and > assertEquals? assertEqual, assertEquals and failUnless are three spellings for the same thing. There is no difference. -- Steven D'Aprano __

[Tutor] unittest

2010-03-03 Thread C.T. Matsumoto
Hello, Can someone tell me the difference between unittests assertEqual and assertEquals? Cheers, T ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Unittest

2008-07-17 Thread Oleg Oltar
And also: Getting this in console when trying to generate report via HTMLTestRunner (it displayed text correctly when tried simple unittest.main) pass output_list['pt1.1'] = '!!! True\nÐ"омен \'foobar\' занят. Рекомендованные свободные домены: ffoobar foobar.

Re: [Tutor] Unittest

2008-07-17 Thread Oleg Oltar
beryl:~ oleg$ env MANPATH=/usr/share/man:/usr/local/share/man:/usr/X11/man TERM_PROGRAM=Apple_Terminal TERM=xterm-color SHELL=/bin/bash TMPDIR=/var/folders/PC/PCtFE4gQGiqpQymiAScfnk+++TM/-Tmp-/ Apple_PubSub_Socket_Render=/tmp/launch-UNXiC6/Render TERM_PROGRAM_VERSION=237 USER=oleg COMMAND_MODE=unix

Re: [Tutor] Unittest

2008-07-17 Thread Mark Tolonen
You get the "D" characters when decoding Russian encoded in UTF-8 using Latin-1 instead. # coding: utf-8 x=u'Зарегистрироваться' print x.encode('utf-8').decode('latin-1') Зарегистрироваться Check that your html encoding is declared correctly. -- Mark "Oleg Oltar" <[EMAIL P

Re: [Tutor] Unittest

2008-07-16 Thread Oleg Oltar
Ok, seems it's my console setting. Tried console with koi8-r (from http://vak.ru/doku.php/macosx-russian), and it looks ok there. Mean the satndard output, but still getting "D" chars instead of russian when trying to convert it to html via HTMLTestRunner (see http://tungwaiyip.info/software/HTMLTe

Re: [Tutor] Unittest

2008-07-16 Thread Mark Tolonen
OK, your console is set to 'ascii' ('cp437' was my example and is the Windows console encoding). 'ascii' won't be able to display Russian. It shouldn't have displayed the "ИзвениÑ" characters either. Are you still running on the same terminal that display those characters? Can you change yo

Re: [Tutor] Unittest

2008-07-16 Thread Oleg Oltar
And in case: # coding: utf-8 import traceback try: raise Exception(u'Зрегиться') except Exception,e: print traceback.format_exc().decode('utf-8').encode('cp437', 'replace') Getting beryl:~ oleg$ python ./wish/newaccount/reg.py Traceback (most recent call last): File "./wish/newaccount

Re: [Tutor] Unittest

2008-07-16 Thread Mark Tolonen
The Exception is output in the encoding of the source file. If the terminal you are displaying the exception on is in a different encoding, it will be garbled. I'm not familiar with OS X's terminal. Try running python and printing sys.stdout.encoding. Alternatively, wrap your code in a try/e

Re: [Tutor] Unittest

2008-07-16 Thread Oleg Oltar
> > The code # -*- coding: utf-8 -*- #!/usr/bin/python """ This test case check how system works in the situation, when user tries to use already used username (domain) We are creating two accounts with such parameters: 1. Sex = Femle 2. Name1=Name2 = foobar%S 3. Pass1 = Name 4. Pass2 = Name

Re: [Tutor] Unittest

2008-07-16 Thread Oleg Oltar
In [1]: import sys In [2]: sys.getdefaultencoding() Out[2]: 'ascii' In [3]: sys.stdout.encoding Out[3]: 'US-ASCII' On Thu, Jul 17, 2008 at 6:29 AM, Oleg Oltar <[EMAIL PROTECTED]> wrote: > Seems need help there. Start getting > > Traceback (most recent call last): > File "./newaccount/Same_dom

Re: [Tutor] Unittest

2008-07-16 Thread Oleg Oltar
Seems need help there. Start getting Traceback (most recent call last): File "./newaccount/Same_domain_name.py", line 56, in test_create_account_to_check print sel.get_text("check_username_block") UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range

Re: [Tutor] Unittest

2008-07-16 Thread Kent Johnson
Another possibility - do you have a coding declaration in your source file, something like # -*- coding: -*- If so, does the coding declaration match the actual encoding of the file? Kent On Wed, Jul 16, 2008 at 5:11 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Wed, Jul 16, 2008 at 2:40 PM,

Re: [Tutor] Unittest

2008-07-16 Thread Kent Johnson
On Wed, Jul 16, 2008 at 2:40 PM, Oleg Oltar <[EMAIL PROTECTED]> wrote: > Hi I am using unittest framework with selenium. > > When I tried this code (my verification point) > > self.assertEqual(True, sel.is_text_present(u"Извените пароли не > совпадают"), "System didn't give a correct warnin

[Tutor] Unittest

2008-07-16 Thread Oleg Oltar
Hi I am using unittest framework with selenium. When I tried this code (my verification point) self.assertEqual(True, sel.is_text_present(u"Извените пароли не совпадают"), "System didn't give a correct warning about the password misstype") Where u"Извените пароли не совпадают" is russian

Re: [Tutor] Unittest. Run test case independently

2008-07-16 Thread Kent Johnson
On Wed, Jul 16, 2008 at 2:58 AM, Oleg Oltar <[EMAIL PROTECTED]> wrote: > Is that possible to run test cases independently (without unittest.main) and > how to do it > > E.g. I tried it this way: > > import random > import unittest > > class TestSequenceFunctions(unittest.TestCase): > > def setU

[Tutor] Unittest. Run test case independently

2008-07-16 Thread Oleg Oltar
Is that possible to run test cases independently (without unittest.main) and how to do it E.g. I tried it this way: import random import unittest class TestSequenceFunctions(unittest.TestCase): def setUp(self): self.seq = range(10) def testshuffle(self): # make sure the

Re: [Tutor] Unittest traceback

2008-04-04 Thread Kent Johnson
Oleg Oltar wrote: > Hi! > > I am trying to use unittest in python first time. But have a strange > traceback each time I run my sample tests. How are you running the test? My guess is that you are running it in an IDE or something that shows the normal system exit exception. Calling sys.exit(

[Tutor] Unittest traceback

2008-04-04 Thread Oleg Oltar
Hi! I am trying to use unittest in python first time. But have a strange traceback each time I run my sample tests. Can you please explain why I have it. No info about it in the doc. e.g. the code is import unittest import squaren class TestCases(unittest.TestCase): def setUp(self): p

Re: [Tutor] Unittest not running all test cases

2006-04-07 Thread Carroll, Barry
Kent: > -Original Message- > From: Kent Johnson [mailto:[EMAIL PROTECTED] > Sent: Friday, April 07, 2006 3:59 PM > To: Carroll, Barry > Subject: Re: [Tutor] Unittest not running all test cases > > Carroll, Barry wrote: > > Kent: > > > > I just rec

Re: [Tutor] Unittest not running all test cases

2006-04-07 Thread Carroll, Barry
arry [EMAIL PROTECTED] 541-302-1107 We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed > -Original Message- > Date: Fri, 07 Apr 2006 15:42:15 -0400 > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [T

Re: [Tutor] Unittest not running all test cases

2006-04-07 Thread Kent Johnson
Carroll, Barry wrote: > Greetings: > > I'm not certain this is the right forum for this question. If not, please point me to the correct one. > > I am using the unittest module to test a package our team is writing. > I presently have three modules of test cases and a top level module to run the

[Tutor] Unittest not running all test cases

2006-04-07 Thread Carroll, Barry
Greetings: I'm not certain this is the right forum for this question. If not, please point me to the correct one. I am using the unittest module to test a package our team is writing. I presently have three modules of test cases and a top level module to run the entire suite. The hierarch

Re: [Tutor] unittest and private methods

2006-01-21 Thread Kent Johnson
lemeia wrote: > kent wrote: >>Rereading your mail another possibility comes to mind. It sounds like >>extractTo() is a general-purpose function that is used for a specific >>purpose by the module you are testing. Why not extract extractTo to a >>utility module? Then you can test it as much as yo

Re: [Tutor] unittest and private methods

2006-01-21 Thread Alan Gauld
> I'm really enjoying Python. I don't like the "sentence structure" quite > as much as Smalltalk (ie I like anObject actOn: a untilYouSee: b), Have you looked at Objective C? It uses Smalltalk style messaging, but in a C language framework. > I find it much faster to do things in Python even ov

Re: [Tutor] unittest and private methods

2006-01-20 Thread lemeia
kent wrote: > > I currently have a class where I have quite a few private methods. > > One > of these methods is a small general utility that extracts characters > from provided text up until it reaches a delimiter. Something like > extractTo(self, text, delimiter). > > > > It's not a relevant int

Re: [Tutor] unittest and private methods

2006-01-20 Thread Kent Johnson
lemeia wrote: > I currently have a class where I have quite a few private methods. > One of these methods is a small general utility that extracts characters from provided text up until it reaches a delimiter. Something like extractTo(self, text, delimiter). > > It's not a relevant interface to th

[Tutor] unittest and private methods

2006-01-20 Thread lemeia
I currently have a class where I have quite a few private methods. One of these methods is a small general utility that extracts characters from provided text up until it reaches a delimiter. Something like extractTo(self, text, delimiter). It's not a relevant interface to the class, just a uti

Re: [Tutor] unittest: looking for examples

2005-08-17 Thread Kent Johnson
Christian Meesters wrote: > - unittests for methods of classes getting all data from a file as a > classmethod Not sure what you mean by this, can you give a simple example? > - unittests for reading and saving files in a specific way (= sanity > tests for file handling) When I want to test a

[Tutor] unittest: looking for examples

2005-08-17 Thread Christian Meesters
Hi Does anybody know examples using the unittest module for the following cases (or some parts of it)? - unittests for methods of classes getting all data from a file as a classmethod - unittests for reading and saving files in a specific way (= sanity tests for file handling) Point is that I