black/tests
Richard Si 0753d99519
Improve Python 2 only syntax detection (GH-2592)
* Improve Python 2 only syntax detection

First of all this fixes a mistake I made in Python 2 deprecation PR
using token.* to check for print/exec statements. Turns out that
for nodes with a type value higher than 256 its numeric type isn't
guaranteed to be constant. Using syms.* instead fixes this.

Also add support for the following cases:

    print "hello, world!"

    exec "print('hello, world!')"

    def set_position((x, y), value):
        pass

    try:
        pass
    except Exception, err:
        pass

    raise RuntimeError, "I feel like crashing today :p"

    `wow_these_really_did_exist`

    10L

* Add octal support, more test cases, and fixup long ints

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-11-11 20:28:48 -05:00
..
data Improve Python 2 only syntax detection (GH-2592) 2021-11-11 20:28:48 -05:00
__init__.py Remove deprecated use of 'setup.py test' (#1275) 2020-05-08 06:23:50 -07:00
conftest.py Use optional tests for "no_python2" to simplify local testing (#2203) 2021-05-07 15:03:13 +02:00
empty.toml Add --target-version option to allow users to choose targeted Python versions (#618) 2019-02-06 18:43:50 -08:00
optional.py Use optional tests for "no_python2" to simplify local testing (#2203) 2021-05-07 15:03:13 +02:00
test_black.py Improve Python 2 only syntax detection (GH-2592) 2021-11-11 20:28:48 -05:00
test_blackd.py re-implement simple CORS middleware for blackd (#2500) 2021-09-25 12:58:44 +01:00
test_format.py Add --projects cli flag to black-primer (#2555) 2021-10-27 11:31:34 -07:00
test_ipynb.py fix: allow tests to be run from (hopefully) any directory (GH-2574) 2021-10-30 11:50:45 -04:00
test_no_ipynb.py Jupyter notebook support (#2357) 2021-08-06 16:57:46 -04:00
test_primer.py Use STDIN project in test_projects to ensure it runs quickly (#2575) 2021-10-30 11:54:43 -07:00
test.toml Switch toml TOML library for tomli (#2301) 2021-07-12 16:01:38 -04:00
util.py Print out line diff on test failure (#2552) 2021-10-27 07:37:20 -07:00