diff options
author | Guido van Rossum <guido@python.org> | 1993-11-11 10:31:23 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-11-11 10:31:23 (GMT) |
commit | b31c7f732aea6abf6ce24d3da7fd67b2172acec9 (patch) | |
tree | e97a352f4308578604255065063766f303ee788d /Lib/test/test_grammar.py | |
parent | 52f2c05401ab13eab45a91d39089866f55ef3c9b (diff) | |
download | cpython-b31c7f732aea6abf6ce24d3da7fd67b2172acec9.zip cpython-b31c7f732aea6abf6ce24d3da7fd67b2172acec9.tar.gz cpython-b31c7f732aea6abf6ce24d3da7fd67b2172acec9.tar.bz2 |
* test_select.py: (some) tests for built-in select module
* test_grammar.py, testall.out: added test for funny things in string literals
* token.py, symbol.py: definitions used with built-in parser module.
* tokenize.py: added double-quote recognition
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r-- | Lib/test/test_grammar.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 4c9e7b0..742477f 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -62,6 +62,22 @@ x = 3.e14 x = .3e14 x = 3.1e4 +print '1.1.3 String literals' + +def assert(s): + if not s: raise TestFailed, 'see traceback' + +x = ''; y = ""; assert(len(x) == 0 and x == y) +x = '\''; y = "'"; assert(len(x) == 1 and x == y and ord(x) == 39) +x = '"'; y = "\""; assert(len(x) == 1 and x == y and ord(x) == 34) +x = "doesn't \"shrink\" does it" +y = 'doesn\'t "shrink" does it' +assert(len(x) == 24 and x == y) +x = "doesn \"shrink\" doesn't it" +y = 'doesn "shrink" doesn\'t it' +assert(len(x) == 25 and x == y) + + print '1.2 Grammar' print 'single_input' # NEWLINE | simple_stmt | compound_stmt NEWLINE |