##// END OF EJS Templates
Merge pull request #1934 from minrk/cellmd...
Merge pull request #1934 from minrk/cellmd Cell/Worksheet metadata * metadata dicts are attached to cells and worksheets * restores collapsed flag to the nbformat - this change happened in the refactor, and was undocumented, and possibly accidental. But we should either document it or fix it, and this includes a fix. * adds a new field, `nbformat_minor`, used to denote minor bumps of the notebook format that expose new capabilities but don't prevent loading by older clients. * Add a warning in Javascript if loading a multiworksheet notebook (which will exist in the future) as current JS code will only save the first. closes #1915

File last commit:

r2640:93949c91
r7612:ca7d2a9c merge
Show More
test_completion_lexer.py
47 lines | 1.4 KiB | text/x-python | PythonLexer
/ IPython / frontend / qt / console / tests / test_completion_lexer.py
# Standard library imports
import unittest
# System library imports
from pygments.lexers import CLexer, CppLexer, PythonLexer
# Local imports
from IPython.frontend.qt.console.completion_lexer import CompletionLexer
class TestCompletionLexer(unittest.TestCase):
def testPython(self):
""" Does the CompletionLexer work for Python?
"""
lexer = CompletionLexer(PythonLexer())
# Test simplest case.
self.assertEquals(lexer.get_context("foo.bar.baz"),
[ "foo", "bar", "baz" ])
# Test trailing period.
self.assertEquals(lexer.get_context("foo.bar."), [ "foo", "bar", "" ])
# Test with prompt present.
self.assertEquals(lexer.get_context(">>> foo.bar.baz"),
[ "foo", "bar", "baz" ])
# Test spacing in name.
self.assertEquals(lexer.get_context("foo.bar. baz"), [ "baz" ])
# Test parenthesis.
self.assertEquals(lexer.get_context("foo("), [])
def testC(self):
""" Does the CompletionLexer work for C/C++?
"""
lexer = CompletionLexer(CLexer())
self.assertEquals(lexer.get_context("foo.bar"), [ "foo", "bar" ])
self.assertEquals(lexer.get_context("foo->bar"), [ "foo", "bar" ])
lexer = CompletionLexer(CppLexer())
self.assertEquals(lexer.get_context("Foo::Bar"), [ "Foo", "Bar" ])
if __name__ == '__main__':
unittest.main()