summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordomspad <devnull@localhost>2016-06-02 14:16:57 -0700
committerdomspad <devnull@localhost>2016-06-02 14:16:57 -0700
commit609e62a32994cacaaa0f2676eff1f992317dd769 (patch)
treeea330761b4de63d6629d3f0a247f1cc60378b3db /tests
parentc45584d2421d92a2134058e86e54f0bea3f121e5 (diff)
downloadpygments-609e62a32994cacaaa0f2676eff1f992317dd769.tar.gz
added test for python3 at operator
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..62c155f7 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.TestClass):
+ 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)))