Add tests for 7bit latin-1 encoding
pmarti opened this issue · 4 comments
This area was slightly broken until recently due to our lack of unittests in this area. Having some unittests that explicitly target 7bit decoding (and not the rest of the PDU toolchain) would be very nice.
Just added some tests in fed5ed1
This has helped to find an incorrect translation (ñ) in gsm0338.py, I need to add more tests or pimp up the existing ones to make sure the rest of the gsm0338 characters are OK.
I'm not sure if you meant Unicode <-> GSM 0338 encoding tests, I just added those and uncovered a couple of little bugs. There's still one thing I can't quite get my head around, are we supposed to be able to encode and decode 0x0000? For now I excluded it from the test, but if so we should fix the code and enable it in the test.
Not really sure about 0x0000... I guess that for quality-wise would be good to handle it. Please do apply your patches
I pushed the three remaining patches. I held fire on the 0x0000 mapping, at the moment it would be asymmetric so could only go in the encode method with 'replace', but I think there is a special sequence of events that might allow it to be decoded too. It's something like if '\x40' appears when it's followed by valid character it becomes '@' if it's followed by '\x00' it's 0x0000.