Skip to content

Commit

Permalink
Add test reproducing StrAndRepr.__repr__ issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaswiman committed Mar 2, 2017
1 parent fec0503 commit cf942df
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions parsimonious/tests/test_grammar.py
@@ -1,6 +1,9 @@
# coding=utf-8

from sys import version_info
from unittest import TestCase

import sys
from nose import SkipTest
from nose.tools import eq_, assert_raises, ok_
from six import text_type
Expand Down Expand Up @@ -440,3 +443,11 @@ def test_parse_failure(self):
assert_raises(ParseError,
grammar.parse,
[Token('tokenBOO'), Token('token2')])

def test_token_repr(self):
t = Token(u'💣')
self.assertTrue(isinstance(t.__repr__(), str))
if sys.version_info < (3, 0):
self.assertEqual(u'<Token "💣">'.encode('utf-8'), t.__repr__())
else:
self.assertEqual(u'<Token "💣">', t.__repr__())

0 comments on commit cf942df

Please sign in to comment.