Re: "finally" for unit test

2007-03-23 Thread killkolor
I went with the TestCase.setUp() function.
Thanks a lot!

-- 
http://mail.python.org/mailman/listinfo/python-list


"finally" for unit test

2007-03-23 Thread killkolor
hi!

I have a unittest framework that tests a single function that in turn
works with files (takes input and outputs in the same file, no return
values).
In the unittest class I assign a member with all the names of my
testfiles and a testdirectory. The tests call the function (which
opens and writes to the file) and then opens the file to see if
everything is in order. The problem now is that after each testrun I
have to copy "fresh" files into the testdirectory, since of course the
function already run on all the files and made the changes. So I
implemented a buffering in the unittest functions: buffer the file,
call the function, make the test, write the buffered file back. This
works fine for unittests that do not fail. If a unittest fails though
the function stops and the writing back is never done. Is there
something like a finally for unittest functions? Or could I use
another approach to buffer and write back my files (for each unittest
function)?
thanks!
gabriel

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: replace illegal xml characters

2007-03-21 Thread killkolor
> Does InDesign export broken XML documents?  What exactly is your problem?

yes, unfortunately it does. it uses all possible unicode characters,
though not all are alowed in valid xml (see link in the first post).
in any way for my application i should be checking if the xml that
comes in is valid and replace all non-valid characters. is there
something out there to do this?

-- 
http://mail.python.org/mailman/listinfo/python-list


replace illegal xml characters

2007-03-21 Thread killkolor
hi!

I am working with InDesign exported xml and parse it in a python
application. I learned here: 
http://boodebr.org/main/python/all-about-python-and-unicode
that there actually are sets of illegal unicode characters for xml
(and henceforth for every compliant xml parser). I already implemented
a regex solution to replace the characters in question, but I wonder
if there is a efficient and out-of-the-box solution somewhere out
there for this problem. does anybody know?

thanks!
gabriel

-- 
http://mail.python.org/mailman/listinfo/python-list