| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
It looks like tests for 3.6 are failing because they are run on 3.6a4 x = 5; y: Optional['C'] = None
^
SyntaxError: invalid syntax
other tests are OK |
Sorry, something went wrong.
|
I removed the test modules, anyway they are failing now (SyntaxError), but they will be in 3.6b1 test suite and will work. |
Sorry, something went wrong.
| from unittest import TestCase, main, skipUnless, SkipTest | ||
| if sys.version_info[:2] >= (3, 6): | ||
| import ann_module, ann_module2, ann_module3 | ||
| from test import ann_module, ann_module2, ann_module3 |
There was a problem hiding this comment.
Honestly I think this points to a different problem.
The stdlib tests for variable annotations syntax should be moved to a different file altogether (maybe test_annotations.py?). Then we won't need this stuff here. (Also, I really want the text of typing.py and test_typing.py to be identical in Py3.5, Py3.6, and here.)
Sorry, something went wrong.
|
Regarding the test failure for the 3.6 nightly build, some guesses as to why it fails to import ann_module from test:
|
Sorry, something went wrong.
|
Hm, I just looked more carefully and those three modules are imported to test get_type_hints(). I think that can to be done somewhat differently, using the same pattern as used for PY35_TESTS. |
Sorry, something went wrong.
|
@gvanrossum exec(PY36_TESTS)
File "<string>", line 6
x: ClassVar[Optional['B']] = None
^
SyntaxError: invalid syntax
I import modules, to check that get_type_hints also works on modules, and to check that it correctly evaluates forward references in namespaces of modules. |
Sorry, something went wrong.
|
Looks like the nightly build doesn't even have PEP 526 support yet... Let's just wait a day. |
Sorry, something went wrong.
|
Can you at least get that test to pass with a 3.6 built from the HEAD locally? |
Sorry, something went wrong.
|
I just did hg pull and hg checkout tip and I cannot build Python, it returns veeeery long error ending in Modules/_sre.o:/home/ivan/Devel/hg-cpython/./Modules/sre_lib.h:543: more undefined references to `PyErr_CheckSignals' follow collect2: error: ld returned 1 exit status make: *** [Programs/_freeze_importlib] Error 1 |
Sorry, something went wrong.
|
try make clean or make clobber? On Fri, Sep 9, 2016 at 2:28 PM, Ivan Levkivskyi notifications@github.com
--Guido van Rossum (python.org/~guido) |
Sorry, something went wrong.
|
Or cp Modules/Setup.dist Modules/Setup On Fri, Sep 9, 2016 at 2:30 PM, Guido van Rossum notifications@github.com
--Guido van Rossum (python.org/~guido) |
Sorry, something went wrong.
|
OK, I managed that and get these errors: ======================================================================
ERROR: test_get_type_hints_ClassVar (__main__.GetTypeHintTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_typing.py", line 1214, in test_get_type_hints_ClassVar
self.assertEqual(gth(B, locals()),
File "/Users/guido/src/typing/src/typing.py", line 1296, in get_type_hints
value = _eval_type(value, globalns, localns)
File "/Users/guido/src/typing/src/typing.py", line 288, in _eval_type
return t._eval_type(globalns, localns)
File "/Users/guido/src/typing/src/typing.py", line 1154, in _eval_type
return type(self)(_eval_type(self.__type__, globalns, localns),
File "/Users/guido/src/typing/src/typing.py", line 288, in _eval_type
return t._eval_type(globalns, localns)
File "/Users/guido/src/typing/src/typing.py", line 524, in _eval_type
for t in self.__union_params__)
File "/Users/guido/src/typing/src/typing.py", line 524, in <genexpr>
for t in self.__union_params__)
File "/Users/guido/src/typing/src/typing.py", line 288, in _eval_type
return t._eval_type(globalns, localns)
File "/Users/guido/src/typing/src/typing.py", line 175, in _eval_type
eval(self.__forward_code__, globalns, localns),
File "<string>", line 1, in <module>
NameError: name 'B' is not defined
----------------------------------------------------------------------
|
Sorry, something went wrong.
|
@gvanrossum |
Sorry, something went wrong.
|
@gvanrossum ======================================================================
ERROR: test_type_optional (test.test_typing.TypeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ivan/Devel/hg-cpython/Lib/test/test_typing.py", line 1529, in test_type_optional
A = Optional[Type[BaseException]]
File "/home/ivan/Devel/hg-cpython/Lib/typing.py", line 647, in __getitem__
return Union[arg, type(None)]
File "/home/ivan/Devel/hg-cpython/Lib/typing.py", line 550, in __getitem__
dict(self.__dict__), parameters, _root=True)
File "/home/ivan/Devel/hg-cpython/Lib/typing.py", line 510, in __new__
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
File "/home/ivan/Devel/hg-cpython/Lib/typing.py", line 510, in <genexpr>
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
File "/home/ivan/Devel/hg-cpython/Lib/typing.py", line 1075, in __subclasscheck__
if super().__subclasscheck__(cls):
File "/home/ivan/Devel/hg-cpython/Lib/abc.py", line 225, in __subclasscheck__
for scls in cls.__subclasses__():
TypeError: descriptor '__subclasses__' of 'type' object needs an argument
|
Sorry, something went wrong.
|
OK, but the previous version of test_typing still passes! |
Sorry, something went wrong.
|
Do you need more help? |
Sorry, something went wrong.
|
I will try to fix it, and if will not manage within 30 minutes, then I will ask for help :-) Thanks! |
Sorry, something went wrong.
|
I have fixed all tests locally, the most important fix was to also copy typing to hg tip that means that python/typing is ahead and here are some changes that are not integrated in master hg repo. The easiest fix would be to just copy what we have here (both typing and test_typing) to master hg repo. Could you please do this (of course if you are satisfied with the PR)? |
Sorry, something went wrong.
|
Yay! It works! I'll wait to merge until the nightly build has variable annotations. I also want to port this to the cpython repo. |
Sorry, something went wrong.
|
@gvanrossum |
Sorry, something went wrong.
|
Thanks!! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
I added ClassVar to both Python2 and Python3 (and new version of get_type_hints to Python3 version) in a backward compatible manner.
@gvanrossum Please, take a look.