summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/__future__.py5
-rw-r--r--Lib/test/test_flufl.py27
2 files changed, 32 insertions, 0 deletions
diff --git a/Lib/__future__.py b/Lib/__future__.py
index 915645933c..5ff282f73c 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 0000000000..5a709bc5f5
--- /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()