On 10/03/16 13:33, Patrick Craine wrote:
> I downloaded Python 2.7.11 but for some reason it seems that it's not
> responding the way it¹s supposed to. I haven¹t been able to figure out the
> problem. I¹m on Mac OSX 10.11.3.
You probably didn't need to download Python because it is
installed by d
On Thu, Mar 10, 2016 at 5:33 AM, Patrick Craine
wrote:
> >>> x = int(raw_input('Enter an integer: '))
> if x%2 == 0:
> print 'Even'
> else:
> print 'Odd'
> if x%3 != 0:
> print 'And not divisible by 3'
> Enter an integer: 3
> >>>
>
> It could be your email program that's messing with your indenta
Hey guys,
I¹m at the very beginning of learning programming. I started using Khan
Academy and now am watching the intro course on MIT OpenCourseWare.
I downloaded Python 2.7.11 but for some reason it seems that it's not
responding the way it¹s supposed to. I haven¹t been able to figure out the
pr
Mark Lawrence writes:
> I have found it very helpful to follow conversations if people don't
> top post, but that seems once again to have been completely lost on
> this list. Is it simply too difficult?
Not too difficult, nor lost. By the nature of this forum, many people
have only joined recen
On 09/03/2016 14:19, Bookbag wrote:
Also I found it helpful to learn python 2.7 first. Since you will need it to
analyze old code.
Original Message
From: Alan Gauld
Sent: March 9, 2016 3:33:10 AM EST
To: tutor@python.org
Subject: Re: [Tutor] newbie in programming
On 09/03
Also I found it helpful to learn python 2.7 first. Since you will need it to
analyze old code.
Original Message
From: Alan Gauld
Sent: March 9, 2016 3:33:10 AM EST
To: tutor@python.org
Subject: Re: [Tutor] newbie in programming
On 09/03/16 06:31, alireza sadeh seighalan
3:33:10 AM EST
To: tutor@python.org
Subject: Re: [Tutor] newbie in programming
On 09/03/16 06:31, alireza sadeh seighalan wrote:
> i am very newbie in programming. i want to start with Python. would you
> guide me ? please introduce me some good python tutorial for a newbie .
> thanks in
Alan,
Thanks for pointing us to your extensive, extremely useful website! So much
good stuff in their!
Many thanks, Lisa
On Wed, Mar 9, 2016 at 3:33 AM, Alan Gauld
wrote:
> On 09/03/16 06:31, alireza sadeh seighalan wrote:
>
> > i am very newbie in programming. i want to start with Python. wou
On 09/03/16 06:31, alireza sadeh seighalan wrote:
> i am very newbie in programming. i want to start with Python. would you
> guide me ? please introduce me some good python tutorial for a newbie .
> thanks in advance
You could try my tutorial (see below) or there is a list of
non-programmers t
hi everyone
i am very newbie in programming. i want to start with Python. would you
guide me ? please introduce me some good python tutorial for a newbie .
thanks in advance
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription
On 11/11/15 20:12, Mark Lawrence wrote:
On 11/11/2015 19:38, George Henry wrote:
How do I find a site to download Python for Windows that includes a
Toolbar?
So IDLE is not good enough for you? I'll let you find it as it's part
of the standard library, i.e. you've all ready downloaded it.
On 11/11/2015 19:38, George Henry wrote:
How do I find a site to download Python for Windows that includes a Toolbar?
I'm using Windows 8.1 Have tried installing Python 3.4.2 but notice that
the Python shell does not include a tool bar (i.e. File, Edit, Shell, Debug,
etc.).
Help please.
Thank
d, 11 Nov 2015 11:38:47 -0800
> Subject: [Tutor] Newbie Question
>
> How do I find a site to download Python for Windows that includes a Toolbar?
>
> I'm using Windows 8.1 Have tried installing Python 3.4.2 but notice that
> the Python shell does not include a tool bar (i.e.
How do I find a site to download Python for Windows that includes a Toolbar?
I'm using Windows 8.1 Have tried installing Python 3.4.2 but notice that
the Python shell does not include a tool bar (i.e. File, Edit, Shell, Debug,
etc.).
Help please.
Thanks!
_
On Sep 19, 2015 6:22 PM, "David" wrote:
>
> Hello Peter,
>
> this was indeed the problem -- I didn't go through manage.py! Weird I
> didn't have that on the radar anymore.
>
> Putting lists/ onto the Python path did not solve the problem.
>
You probably want to put the *parent* of lists/ onto the
Hello Peter,
this was indeed the problem -- I didn't go through manage.py! Weird I
didn't have that on the radar anymore.
Putting lists/ onto the Python path did not solve the problem.
Thanks for your help!
David
On 19/09/15 16:07, Peter Otten wrote:
> David wrote:
>
>> Dear Tutors,
>>
>> I
David wrote:
> Dear Tutors,
>
> I am reading through Harry Percival's "Test-Driven Development with
> Python".
>
> As I finished chapter 3 yesterday, I was fully on track, perfectly
> aligned with the book.
>
> Today I restarted my computer, activated the virtualenv in question --
> and get an
Dear Tutors,
I am reading through Harry Percival's "Test-Driven Development with
Python".
As I finished chapter 3 yesterday, I was fully on track, perfectly
aligned with the book.
Today I restarted my computer, activated the virtualenv in question --
and get an error message that was not there b
On Thu, Jun 25, 2015 at 02:42:16PM -0400, Saran Ahluwalia wrote:
> My question can be found here:
>
> http://stackoverflow.com/questions/31058100/enumerate-column-headers-in-csv-that-belong-to-the-same-tag-key-in-python
You might think you are saving time in not typing the question twice,
but y
On 25/06/2015 23:51, Alan Gauld wrote:
On 25/06/15 19:42, Saran Ahluwalia wrote:
My question can be found here:
http://stackoverflow.com/questions/31058100/enumerate-column-headers-in-csv-that-belong-to-the-same-tag-key-in-python
It would have been helpful to post the question here rather th
On 25/06/15 19:42, Saran Ahluwalia wrote:
My question can be found here:
http://stackoverflow.com/questions/31058100/enumerate-column-headers-in-csv-that-belong-to-the-same-tag-key-in-python
It would have been helpful to post the question here rather than just a
link.
However, having read i
My question can be found here:
http://stackoverflow.com/questions/31058100/enumerate-column-headers-in-csv-that-belong-to-the-same-tag-key-in-python
Here is an additional sample sample of the XML that I am working with:
0
0
0
0
Am 02.05.2015 um 09:58 schrieb Alan Gauld:
I made no mention of green because it is not a tuple.
Can you see why 'in' is not the right test for green. Can you see
why the interpreter is complaining?
*This is what I programmed:*
number = int(input('Enter a number between 0 and 36: '))
green_nu
1) Please reply-list, or if your email program doesn't support that, do
a reply-all. The idea is to make sure tutor@python.org is in your To:
field. Otherwise you're just leaving private messages, and that's not
what a public forum like this is about.
2) Please use text email, not html. As
Please use ReplyAll to include everyone on the the list.
On 02/05/15 03:26, Jag Sherrington wrote:
Hi Alan
Thanks for your help. I followed your instruction and get the
following message:
Enter a number between 0 and 36: 9
Traceback (most recent call last):
File "C:\Python34\Tests\Roulette_w
On 30/04/15 04:58, Jag Sherrington wrote:
Can anyone please tell me what I am doing wrong?As this code I have for the
Roulette Wheel colours exercise, won't work. number = int(input('Enter a number
between 0 and 36: '))green_number = (0) red_number = (1, 3, 5, 7, 9, 12, 14,
16, 18, 19, 21, 23,
On 04/29/2015 11:58 PM, Jag Sherrington wrote:
Can anyone please tell me what I am doing wrong?As this code I have for the
Roulette Wheel colours exercise, won't work. number = int(input('Enter a number
between 0 and 36: '))green_number = (0) red_number = (1, 3, 5, 7, 9, 12, 14,
16, 18, 19, 21
Can anyone please tell me what I am doing wrong?As this code I have for the
Roulette Wheel colours exercise, won't work. number = int(input('Enter a number
between 0 and 36: '))green_number = (0) red_number = (1, 3, 5, 7, 9, 12, 14,
16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36) black_number = (2,
Please evaluate your email program. Some of your newline s are
being lost in the paste into your email.
Matt Varner Wrote in message:
> TL:DR - Skip to "My Script: "subtrans.py"
>
>
>
> Optional Links to (perhaps) Helpful Images:
> 1. The SRT download button:
> http://i70.photobucket.com/alb
Matt Varner wrote:
> This result works perfectly (REMs removed):
>
> f = open('tmp.txt', 'r')
> o = open('result.txt', 'w')
> lns = f.readlines()
> f.close()
> for line in lns:
> if ".\n" in line:
> a = line.replace('.\n','. ')
> o.write(a)
> else:
> a = line.stri
Alan G wrote: "This is a bad idea. Instead, write your strings directly to o
o.write(s)
Print adds newlines automatically(unless you explicitly suppress
them). But printing to a file is messy compared to writing directly to
the file. (And also means you cant print debug messages while
developing
[code cut]
Hi Matt,
It looks like you're trying to write your own srt parser as part of this
problem. If you're in a hurry, you may want to look at existing parsers
that people have written. For example:
https://github.com/byroot/pysrt
But, even though it successfully kills these additi
On 31/10/14 11:07, Matt Varner wrote:
# Import sys to get at stdout (standard output) - "print" results will
be written to file
import sys
This is a bad idea.
Instead, write your strings directly to o
o.write(s)
Print adds newlines automatically(unless you explicitly suppress them).
But prin
TL:DR - Skip to "My Script: "subtrans.py"
Optional Links to (perhaps) Helpful Images:
1. The SRT download button:
http://i70.photobucket.com/albums/i82/RavingNoah/Python%20Help/tutor1_zps080f20f7.png
2. A visual comparison of my current problem (see 'Desire Versus
Reality' below):
http://i70.ph
On 13/09/13 15:59, Paul Smith wrote:
So there are many tools out there but mechanize and scrapy 3rd party
modules seem to produce the best results; however nothing like these
exist for Python3. I get close but cannot produce the clean simple url
results in python3
Yes that's the biggest barrie
Attempting a simple web crawler in python3, browse a url -
collect/clean/produce valid url list from a url; random choice from valid
url list; visit new url repeat process - collect/clean/produce valid url
list from new url...
So there are many tools out there but mechanize and scrapy 3rd party
mo
On 02/15/2013 04:03 PM, Albert-Jan Roskam wrote:
>
>> Eventually what I'll need to do is:
>> 1. Index the file and/or count the lines, as to identify each line's
>> positional relevance so that it can average any range of numbers that are
>> sequential; one to one another.
> In other words: you
> Eventually what I'll need to do is:
>
> 1. Index the file and/or count the lines, as to identify each line's
> positional relevance so that it can average any range of numbers that are
> sequential; one to one another.
In other words: you would like to down-sample your data? For example, r
@ Stephen,
Thank you for the answers. I appreciate your understanding, and
patience; I understand that it was confusing (unintentionally) and
probably irritating to any of the seasoned tutor list members.
Your examples helped greatly, and was the push I needed. Happy Friday,
and thanks again,
@Bob @David -- I gave you all the other parts to give you a background,
and context as it relates to my 'problem'. My apologies if it seems
obfuscated. I took an hour to write that email, and revised it several
times in an attempt to provide good information. Please disregard my OP.
On 02/14/
On 2/14/2013 3:55 PM, Michael McConachie wrote:
[snip]
I agree with dave angel - the specification is far from clear. please
clarify. perhaps a simple example that goes from input to desired output.
--
Bob Gailer
919-636-4239
Chapel Hill NC
___
Tuto
On 15/02/13 07:55, Michael McConachie wrote:
Essentially:
1. I have a list of numbers that already exist in a file. I generate this
file by parsing info from logs.
2. Each line contains an integer on it (corresponding to the number of
milliseconds that it takes to complete a certain repeat
On 02/14/2013 03:55 PM, Michael McConachie wrote:
Hello all,
This is my first post here. I have tried to get answers from StackOverflow, but I
realized quickly that I am too "green" for that environment. As such, I have
purchased Beginning Python (2nd edition, Hetland) and also the $29.00 co
Hello all,
This is my first post here. I have tried to get answers from StackOverflow,
but I realized quickly that I am too "green" for that environment. As such, I
have purchased Beginning Python (2nd edition, Hetland) and also the $29.00
course available from learnpythonthehardway(dot)com.
On 05/10/12 10:07, Mark Lawrence wrote:
On 05/10/2012 04:23, ken brockman wrote:
I wonder if they might be a way for some on this forum to dispense
advice and help others without the totally snide and obnoxious
attitude?
I'm firmly with Steven here. If people cannot be bothered to do any
rese
On 05/10/2012 04:23, ken brockman wrote:
I wonder if they might be a way for some on this forum to dispense advice and
help others without the totally snide and obnoxious attitude? if it is so
painfully annoying for you to deal with, why subject yourself to it? I suspect
it is the sheer joy of
Hey Ken,
Steve has just made some innocent fun. He is eager to help the guy. Please
don't be so harsh.
Sincerely
Ashfaq
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
.
From: Steven D'Aprano
To: tutor@python.org
Sent: Thursday, October 4, 2012 1:39 PM
Subject: Re: [Tutor] Newbie help with .pyc
On 05/10/12 01:21, tfahey1 wrote:
> Hey everyone,
>
> I am a Maya user, so I only come into contact with Python scripting on a
> sur
On 05/10/12 01:21, tfahey1 wrote:
Hey everyone,
I am a Maya user, so I only come into contact with Python scripting on a
surface level, but I downloaded a python script from a CG website that I
would like to check out but I am getting an error when it is run.
Would you like us to guess what e
Hey everyone,
I am a Maya user, so I only come into contact with Python scripting on a
surface level, but I downloaded a python script from a CG website that I
would like to check out but I am getting an error when it is run. The only
file included was a .pyc file. I'm wondering if there should al
Check out http://www.udacity.com/
Enroll in few courses - to begin with, check
http://www.udacity.com/view#Course/cs101/CourseRev/apr2012/Unit/671001/Nugget/675002
On Mon, Jul 16, 2012 at 5:09 AM, Matthew Ngaha wrote:
> Hi all. I'm new to Python and Programming in general. I've started out
I would just like to add that I am a web developer and I left PHP for
Python. I left PHP because it was not as powerful server side (Cron Jobs
and Such) and I wanted to possibly create desktop applications, more
recently Android Apps via SL4A and IPhone Apps via pyjamas. PHP is a
limited language a
Thanks guys, i didnt think i would get so many kind and helpful responses.
I am so grateful:x. I have read each and every reply and i am now very
confident in the direction i need to take. Everything is a lot clearer now.
Even though i'm new to programming, i am very intrigued by it and want to
ded
On Mon, Jul 16, 2012 at 5:09 AM, Matthew Ngaha wrote:
> Hi all. I'm new to Python and Programming in general. I've started out with
> Python for beginners, and so far so good. My friend who i might add, is not
> a programmer but has had experience in the world of programming (i dont know
> how muc
Matthew Ngaha wrote:
Hi all. I'm new to Python and Programming in general. I've started out with
Python for beginners, and so far so good. My friend who i might add, is not
a programmer but has had experience in the world of programming (i dont
know how much but he claims a lot), has told me to f
On Mon, Jul 16, 2012 at 9:54 AM, Wayne Werner wrote:
>
> On Mon, 16 Jul 2012, Walter Prins wrote:
>
>> Hi again Matthew,
>>
>> I forgot to include the following link which I originally thought to
>> include, which is one guy's set of (IMHO very cogent) criticisms
>> against PHP as programming lang
On Mon, 16 Jul 2012, Walter Prins wrote:
Hi again Matthew,
I forgot to include the following link which I originally thought to
include, which is one guy's set of (IMHO very cogent) criticisms
against PHP as programming language: http://is.gd/z1POXC Hopefully
it gives you something else to t
Probably the single biggest 'problem' with Python for web development, in
my opinion, is that while a lot of web hosts have all sorts of PHP
templates or frameworks installed and ready for easy deployment... Python
options seem to be a bit sparser. Individual hosts may vary, but thats the
overall
Hi again Matthew,
I forgot to include the following link which I originally thought to
include, which is one guy's set of (IMHO very cogent) criticisms
against PHP as programming language: http://is.gd/z1POXC Hopefully
it gives you something else to think about regarding the PHP vs Python
questi
Hi Matthew,
On 16 July 2012 13:09, Matthew Ngaha wrote:
> Hi all. I'm new to Python and Programming in general. I've started out with
> Python for beginners, and so far so good. My friend who i might add, is not
> a programmer but has had experience in the world of programming (i dont know
> how
Hi all. I'm new to Python and Programming in general. I've started out with
Python for beginners, and so far so good. My friend who i might add, is not
a programmer but has had experience in the world of programming (i dont
know how much but he claims a lot), has told me to forget about Python and
usity.
Sent from my Verizon Wireless BlackBerry
-Original Message-
From: Tom Roche
Sender: tutor-bounces+eire1130=gmail@python.org
Date: Sat, 30 Jul 2011 17:49:02
To:
Reply-To: tutor@python.org, Tom Roche
Subject: [Tutor] newbie needs pypy setup tips
I need advice about config
I need advice about configuring pypy to run other python code. Why I ask:
I'm running a model implemented in python. Unfortunately a run on "straight"
python 2.6.x or 2.7.x requires
- 130 min on my ubuntu laptop (on which working would be more convenient)
- 55 min on a better build machine on w
Unfortunately, most of them seem to be aimed at people who aren't
newbies. I think the world needs a good set of programming puzzles for
beginners.
It would sure be helpful to have a library of newbie type projects ... I'm
teaching myself with the "think like a computer scientist' books, and
Thanks everyone for prompt response and explanation.
Cheers!
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Mon, Aug 30, 2010 at 2:56 PM, Hugo Arts wrote:
> To solve, we have the non-greedy patterns. They eat not as much
> possible, but as little as possible. To make a qualifier non-greedy,
> simply add an asterix at its end:
>
> r'WORD1-.*?'
>
> I would also like to offer one small correction: an a
On Tue, Aug 31, 2010 at 12:02 AM, Serdar Tumgoren wrote:
> To make a qualifier non-greedy,
>>
>> simply add an asterix at its end:
>>
>> r'WORD1-.*?'
>>
>
> Hugo explains this nicely, but I just wanted to make one minor correction
> -- the non-greedy qualifier is the question mark AFTER an the a
On 8/30/2010 4:52 PM, Sam M wrote:
Hi Guys,
I'd like remove contents between tags that matches pattern
"WORD1" as follows:
Change
"stuff word1-emai...@domain.com more stuff
word1-emai...@domain.com still more stuff
word2-emai...@domain.com stuff after WORD2
word1-emai...@domain.com"
To
To make a qualifier non-greedy,
> simply add an asterix at its end:
>
> r'WORD1-.*?'
>
>
Hugo explains this nicely, but I just wanted to make one minor correction
-- the non-greedy qualifier is the question mark AFTER an the asterisk
(which is what Hugo's code shows but I believe he accidentally
On Mon, Aug 30, 2010 at 10:52 PM, Sam M wrote:
> Hi Guys,
>
> I'd like remove contents between tags that matches pattern "WORD1"
> as follows:
>
> Change
> "stuff word1-emai...@domain.com more stuff
> word1-emai...@domain.com still more stuff
> word2-emai...@domain.com stuff after WORD2
> word1-e
Hi Guys,
I'd like remove contents between tags that matches pattern "WORD1"
as follows:
Change
"stuff word1-emai...@domain.com more stuff
word1-emai...@domain.com still more stuff
word2-emai...@domain.com stuff after WORD2
word1-emai...@domain.com"
To
"stuff more stuff still more s
Thanks for the explanation. It's clearer now.
Tommy
"Tommy Kaas" wrote
> > > for row in soup('table', {'class' : 'spad'})[0].tbody('tr'):
> >
> >Do you understand the syntax from a Python point of view?
>
> No. That's the problem.
OK, I'll assume you understand the basic for loop structure
and
"Tommy Kaas" wrote
> > for row in soup('table', {'class' : 'spad'})[0].tbody('tr'):
>
>Do you understand the syntax from a Python point of view?
No. That's the problem.
OK, I'll assume you understand the basic for loop structure
and focus on the function call:
soup('table', {'class' : 'spa
-Oprindelig meddelelse-
Fra: tutor-bounces+tommy.kaas=kaasogmulvad...@python.org
[mailto:tutor-bounces+tommy.kaas=kaasogmulvad...@python.org] På vegne af
Alan Gauld
Sendt: 28. juli 2010 20:00
Til: tutor@python.org
Emne: Re: [Tutor] Newbie question - syntax - BeautifulSoup
"Tommy
"Tommy Kaas" wrote
for row in soup('table', {'class' : 'spad'})[0].tbody('tr'):
The example works fine, and I can change it a bit and it still
works. But I
simply don't understand how I am supposed to the fourth line - after
"for
row in soup". I can clearly see it defines the area I want to
I have just begun a struggle learning Python. I have read most of "Beginning
Python - from Novice to Professional" - and some of it I even understood J
This is my first question to the list. And I'm sure not the last.
I'm especially interested in learning web scraping techniques and here:
http
Thanks a lot for the mails all of you.
Someone commented that wxpython occassionally shows it C/C++ roots. Will
that haunt me cos' I have zero knowledge of C/C++.
That would be me, sorry about that, didn't mean to confuse you further.
Well, think it this way, if you have zero knowledge of C,
Payal writes:
[...]
> Thanks a lot for the mails all of you.
> Someone commented that wxpython occassionally shows it C/C++ roots. Will
> that haunt me cos' I have zero knowledge of C/C++.
>
> What about py-gtk? Is it more pythonic to learn and hence easy?
I've used wx and pygtk and don't reall
On Tue, Jul 06, 2010 at 07:48:53PM +0100, Alan Gauld wrote:
> Nowadays they are all acceptable looking but wxPython would
> be my recommendation, mainly for its support for printing, which
> sounds easy but in Guis is surprisingly difficult. wxPython makes
> it about as easy as it can be.
>
Thanks
Well, choice is a great thing!
Except when you're new and all that choice seems overwhelming :)
When I started out python a year ago, I knew just enough C to know that
I didn't want C/C++ to be my first language that I learned.
That's why I found the wxPython style a nuisance, because I was at t
"Nick Raptis" wrote
Really good news is that on this very list on another thread,
someone suggested Dabo http://dabodev.com/
It's a python library on top of wxPython and it's database-logic-GUI
But its not a complete wrapper for wxPython so you still need
to revert to wxPython at some stage
On Tuesday 06 July 2010 05:35:34 pm Nick Raptis wrote:
> Please excuse if I'm jumping on the topic. Haven't done any GUI work so
> this interests me too.
>
> wxPython always seemed a great choice as it works on all platforms, and
> uses GTK+ for linux.
> Well, what mainly bugs me about wxPython is
Please excuse if I'm jumping on the topic. Haven't done any GUI work so
this interests me too.
wxPython always seemed a great choice as it works on all platforms, and
uses GTK+ for linux.
Well, what mainly bugs me about wxPython is that most of it's API names
come from the wx C library, you al
If you decide to run with wxPython there is a pretty handy video series you
could watch:
http://showmedo.com/videotutorials/series?name=PythonWxPythonBeginnersSeries
Eric
On Tue, Jul 6, 2010 at 1:48 PM, Alan Gauld wrote:
> "Payal" wrote
>
> gui programming? There seems to be many ways to do
"Payal" wrote
gui programming? There seems to be many ways to do gui programming
in
Python namely wxpython, tkinter, gtk, qt etc. Which is the easiest
There are many toolkits but these have as many similarities as
differences.
But none of them will be easy to learn if you have not done GUI
On 6 July 2010 18:09, Payal wrote:
> Hi all,
> Some background before the actual query.
> A friend of mine, an electronics engineer has a
> small co. He had a computer engg. with him who used to design GUI
> front-ends
> for his products in Visual Basic. These apps used to take data from
> serial
Hi all,
Some background before the actual query.
A friend of mine, an electronics engineer has a
small co. He had a computer engg. with him who used to design GUI
front-ends
for his products in Visual Basic. These apps used to take data from
serial port, store it on disk put and show it in excel al
Hello again everyone - and thanks for your responses. Adding the
unittest method message was something I didn't realize I could do!
On Thu, May 6, 2010 at 10:20 PM, Steven D'Aprano wrote:
> With respect to Lie, dynamically adding methods is an advanced technique
> that is overkill for what you s
On Fri, 7 May 2010 03:53:08 am Damon Timm wrote:
> Hi Lie -
>
> Thanks for that idea -- I tried it but am getting an error. I read a
> little about the __dict__ feature but couldn't figure it. I am going
> to keep searching around for how to dynamically add methods to a
> class ... here is the er
On Thu, 6 May 2010 10:37:20 am Damon Timm wrote:
> class TestFiles(unittest.TestCase):
>
> # this is the basic test
> def test_values(self):
> '''see if values from my object match what they should
> match'''
> for file in FILES:
> for k, v in TAG_VA
On Thu, May 6, 2010 at 1:15 PM, Steve Willoughby wrote:
> The unit test methods all take message arguments so if you just
> want to customize the reported error, that's easily done.
>
> something like:
> self.assertEqual(self.file.tags[k], v, "Failure with key "+k)
>
> That's easiest. If you re
The unit test methods all take message arguments so if you just
want to customize the reported error, that's easily done.
something like:
self.assertEqual(self.file.tags[k], v, "Failure with key "+k)
That's easiest. If you really want a separate test for each, you
may want to create a factory
Sorry for the multiple posts ... I'll be quiet for a while until I
find a real answer!
What I wrote below doesn't actually work -- it appears to work because
all the functions have different names but they all reference a single
function ... I should have looked more closely at my initial output..
Ooh! Wait! I found another method that is similar in style and
appears to work ...
class TestFileTags(unittest.TestCase):
pass
for test_name, file, key, value in list_of_tests:
def test_func(self):
self.assertEqual(file.tags[key], value)
setattr(TestFileTags, test_name, tes
Hi Lie -
Thanks for that idea -- I tried it but am getting an error. I read a
little about the __dict__ feature but couldn't figure it. I am going
to keep searching around for how to dynamically add methods to a class
... here is the error and then the code.
Thanks.
# ERROR:
$ python tests_ta
On 05/06/10 10:37, Damon Timm wrote:
> Hi - am trying to write some unit tests for my little python project -
> I had been hard coding them when necessary here or there but I figured
> it was time to try and learn how to do it properly.
>
> This test works, however, it only runs as *one* test (whi
Hi Vincent - Thanks for your input.
Where would I put that string ? In the function's doctsring ? Or
just as a print method ?
I have been looking online some more and it appears there may be a way
to create some sort of generator ... it's still a little confusing to
me, though. I was hoping th
By they way you shouldn't need to use str(file) as I did. Unlessit is
not a string already. Bad habit. I am used to numbers
vincet
On Thursday, May 6, 2010, Vincent Davis wrote:
> I can't think of a way to do what you ask, without defining a test for each.
> ButI think what you might actually wa
I can't think of a way to do what you ask, without defining a test for each.
ButI think what you might actually want is the define the error message to
report which one failed. ie, it's one test with a meaningful error message.
'Failed to load' + str(file)+' '+ str(k)+', '+str(v)
I am not ecpert on
Hi - am trying to write some unit tests for my little python project -
I had been hard coding them when necessary here or there but I figured
it was time to try and learn how to do it properly.
I've read over Python's guide
(http://docs.python.org/library/unittest.html) but I am having a hard
time
1 - 100 of 341 matches
Mail list logo