Skip to content

Commit

Permalink
Merge 0127046 into b0c4218
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Jan 9, 2019
2 parents b0c4218 + 0127046 commit 42ac456
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions posttroll/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ def _decode(rawstr):
rawstr = rawstr.decode('utf-8')
except AttributeError:
pass
except UnicodeEncodeError:
pass
if not rawstr.startswith(_MAGICK):
raise MessageError("This is not a '%s' message (wrong magick word)"
% _MAGICK)
Expand Down
9 changes: 9 additions & 0 deletions posttroll/tests/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ def test_unicode(self):
except UnicodeDecodeError:
self.fail('Unexpected unicode decoding error')

try:
Message(rawstr=u'pytroll://oper/polar/direct_readout/norrköping pong sat@MERLIN 2019-01-07T12:52:19.872171'
' v1.01 application/json {"station": "norrk\u00f6ping"}')
except UnicodeDecodeError:
self.fail('Unexpected unicode decoding error')


def test_pickle(self):
"""Test pickling.
Expand Down Expand Up @@ -170,3 +176,6 @@ def suite():
mysuite.addTest(loader.loadTestsFromTestCase(Test))

return mysuite

if __name__ == '__main__':
unittest.main()

0 comments on commit 42ac456

Please sign in to comment.