summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2016-06-02 17:21:37 -0700
committerTim Hatch <tim@timhatch.com>2016-06-02 17:21:37 -0700
commitb5cfed047012cf4b5e79d350caa8fe10df25e55d (patch)
treee2a1bc91ecfebaddeafd764b0d8aa37654b2abf2 /tests
parent406fa87e97e6f886ea11de21531bcc1f1ae30ebf (diff)
parent0435bbf2b2de3d90cd3053e0a90bfeedb9243b63 (diff)
downloadpygments-b5cfed047012cf4b5e79d350caa8fe10df25e55d.tar.gz
Merged in domspad/pygments-main2 (pull request #603)
test for unicode chars in julia
Diffstat (limited to 'tests')
-rw-r--r--tests/test_python.py65
1 files changed, 64 insertions, 1 deletions
diff --git a/tests/test_python.py b/tests/test_python.py
index fc48624e..f5784cb1 100644
--- a/tests/test_python.py
+++ b/tests/test_python.py
@@ -9,7 +9,7 @@
import unittest
-from pygments.lexers import PythonLexer
+from pygments.lexers import PythonLexer, Python3Lexer
from pygments.token import Token
@@ -48,3 +48,66 @@ class PythonTest(unittest.TestCase):
(Token.Text, '\n'),
]
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
+
+
+class Python3Test(unittest.TestCase):
+ def setUp(self):
+ self.lexer = Python3Lexer()
+
+ def testNeedsName(self):
+ """
+ Tests that '@' is recognized as an Operator
+ """
+ fragment = u'S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)\n'
+ tokens = [
+ (Token.Name, u'S'),
+ (Token.Text, u' '),
+ (Token.Operator, u'='),
+ (Token.Text, u' '),
+ (Token.Punctuation, u'('),
+ (Token.Name, u'H'),
+ (Token.Text, u' '),
+ (Token.Operator, u'@'),
+ (Token.Text, u' '),
+ (Token.Name, u'beta'),
+ (Token.Text, u' '),
+ (Token.Operator, u'-'),
+ (Token.Text, u' '),
+ (Token.Name, u'r'),
+ (Token.Punctuation, u')'),
+ (Token.Operator, u'.'),
+ (Token.Name, u'T'),
+ (Token.Text, u' '),
+ (Token.Operator, u'@'),
+ (Token.Text, u' '),
+ (Token.Name, u'inv'),
+ (Token.Punctuation, u'('),
+ (Token.Name, u'H'),
+ (Token.Text, u' '),
+ (Token.Operator, u'@'),
+ (Token.Text, u' '),
+ (Token.Name, u'V'),
+ (Token.Text, u' '),
+ (Token.Operator, u'@'),
+ (Token.Text, u' '),
+ (Token.Name, u'H'),
+ (Token.Operator, u'.'),
+ (Token.Name, u'T'),
+ (Token.Punctuation, u')'),
+ (Token.Text, u' '),
+ (Token.Operator, u'@'),
+ (Token.Text, u' '),
+ (Token.Punctuation, u'('),
+ (Token.Name, u'H'),
+ (Token.Text, u' '),
+ (Token.Operator, u'@'),
+ (Token.Text, u' '),
+ (Token.Name, u'beta'),
+ (Token.Text, u' '),
+ (Token.Operator, u'-'),
+ (Token.Text, u' '),
+ (Token.Name, u'r'),
+ (Token.Punctuation, u')'),
+ (Token.Text, u'\n'),
+ ]
+ self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))