diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-04-01 05:08:41 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-04-01 05:08:41 (GMT) |
commit | e3944a5e1ecf67aa722fd9ce0c0a4ee72ee5ba2d (patch) | |
tree | bfe3d2c8bdb94c077080240cc73717e16dfcd088 /Lib | |
parent | 4ed72acd68a1a1d90946e189c94b7d656719da45 (diff) | |
download | cpython-e3944a5e1ecf67aa722fd9ce0c0a4ee72ee5ba2d.zip cpython-e3944a5e1ecf67aa722fd9ce0c0a4ee72ee5ba2d.tar.gz cpython-e3944a5e1ecf67aa722fd9ce0c0a4ee72ee5ba2d.tar.bz2 |
The BDFL has retired! Long live the FLUFL (Friendly Language Uncle For Life)!
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/__future__.py | 5 | ||||
-rw-r--r-- | Lib/test/test_flufl.py | 27 |
2 files changed, 32 insertions, 0 deletions
diff --git a/Lib/__future__.py b/Lib/__future__.py index 9156459..5ff282f 100644 --- a/Lib/__future__.py +++ b/Lib/__future__.py @@ -70,6 +70,7 @@ CO_FUTURE_ABSOLUTE_IMPORT = 0x4000 # perform absolute imports by default CO_FUTURE_WITH_STATEMENT = 0x8000 # with statement CO_FUTURE_PRINT_FUNCTION = 0x10000 # print function CO_FUTURE_UNICODE_LITERALS = 0x20000 # unicode string literals +CO_FUTURE_BARRY_AS_BDFL = 0x40000 class _Feature: def __init__(self, optionalRelease, mandatoryRelease, compiler_flag): @@ -126,3 +127,7 @@ print_function = _Feature((2, 6, 0, "alpha", 2), unicode_literals = _Feature((2, 6, 0, "alpha", 2), (3, 0, 0, "alpha", 0), CO_FUTURE_UNICODE_LITERALS) + +barry_as_FLUFL = _Feature((3, 1, 0, "alpha", 2), + (3, 9, 0, "alpha", 0), + CO_FUTURE_BARRY_AS_BDFL) diff --git a/Lib/test/test_flufl.py b/Lib/test/test_flufl.py new file mode 100644 index 0000000..5a709bc --- /dev/null +++ b/Lib/test/test_flufl.py @@ -0,0 +1,27 @@ +import __future__ +import unittest + +class FLUFLTests(unittest.TestCase): + + def test_barry_as_bdfl(self): + code = "from __future__ import barry_as_FLUFL; 2 {0} 3" + compile(code.format('<>'), '<BDFL test>', 'exec', + __future__.CO_FUTURE_BARRY_AS_BDFL) + self.assertRaises(SyntaxError, compile, code.format('!='), + '<FLUFL test>', 'exec', + __future__.CO_FUTURE_BARRY_AS_BDFL) + + def test_guido_as_bdfl(self): + code = '2 {0} 3' + compile(code.format('!='), '<BDFL test>', 'exec') + self.assertRaises(SyntaxError, compile, code.format('<>'), + '<FLUFL test>', 'exec') + + +def test_main(): + from test.support import run_unittest + run_unittest(FLUFLTests) + + +if __name__ == '__main__': + test_main() |