pb with accented character in Match()

16 views
Skip to first unread message

Maryse Sorel

unread,
Jul 24, 2015, 11:15:54 AM7/24/15
to testerm...@googlegroups.com
Hi,

I use Testerman since a few week. (with Python 2.6)

I would like to compare two string with match().

class TC_TEST_MSG(TestCase):
                def body(self, msg, comp):
                        if match(msg, comp):
                               setverdict(PASS)
                         else:
                              setverdict(FAIL)

 

 But if string contains an accented character (é,à,è or ç ) the ats return an error :

TC_TEST_MSG().execute(msg = "çàèabcABCé", comp ="çàèabcABCé")

=> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 16: ordinal not in range(128)


I have tested with unicode ("é"):

TC_TEST_MSG().execute(msg =  u'\u00E7, comp =  u'\u00E7)


=> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 0: ordinal not in range(128))


I have used the file sample/testerman.ats and TC_UNICODE, TC_UNICODE_SESSION_PARAMETERS and TC_BINARY_LOGGING return error to.

It is normal?


Am I doing something wrong ?

Thanks for any help,


Maryse





Sébastien Lefèvre

unread,
Jul 25, 2015, 4:06:42 AM7/25/15
to testerm...@googlegroups.com
Hi Maryse, 

Normally your first TC execution line should use:
TC_TEST_MSG().execute(msg = u"çàèabcABCé", comp = u"çàèabcABCé")
to make sure Python interprets these strings as unicode but anyway the samples are supposed to work.

Let me check this out today.
thanks,
-seb


--
You received this message because you are subscribed to the Google Groups "Testerman Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testerman-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sebastien Lefevre
seb.l...@gmail.com

Sébastien Lefèvre

unread,
Jul 26, 2015, 4:39:19 AM7/26/15
to testerm...@googlegroups.com
Hi Maryse,

could you share your ATS or at least its execution log (from qtesterman, execution window > Raw log tabs, make sure you clicked "update" then "save raw logs")?
I can't reproduce the problem with the samples/testerman.ats TC, the source code is correctly read and interpreted, the logs correctly contain UTF-8 encoded characters. The only problem I have is the way they are _displayed_ in QTesterman log analyzer in real-time mode only (when events are displayed in real-time from the ATS execution) but does not occur with all Qt versions and all OSes, but this does not affect the test logic - template matches do work.

thanks,
-seb
--
Sebastien Lefevre
seb.l...@gmail.com
Reply all
Reply to author
Forward
0 new messages