realizing that #241 is more of a feature than a bug, I disabled the corresponding test. This will be changed once the whole implementation of isinstance becomes more flexible and also allows checks on subclasses, so that no information is lost.

This commit is contained in:
Dave Halter
2014-04-09 16:27:42 +02:00
parent d8d6b20a17
commit 6de46fe373
2 changed files with 21 additions and 0 deletions

View File

@@ -331,6 +331,7 @@ def _check_isinstance_type(evaluator, stmt, search_name):
assert len(obj) == 1 assert len(obj) == 1
assert len(classes) == 1 assert len(classes) == 1
assert isinstance(obj[0], pr.Call) assert isinstance(obj[0], pr.Call)
# names fit? # names fit?
assert str(obj[0].name) == search_name assert str(obj[0].name) == search_name
assert isinstance(classes[0], pr.StatementElement) # can be type or tuple assert isinstance(classes[0], pr.StatementElement) # can be type or tuple

View File

@@ -34,11 +34,14 @@ if 2:
# ----------------- # -----------------
import datetime import datetime
def fooooo(obj): def fooooo(obj):
if isinstance(obj, datetime.datetime): if isinstance(obj, datetime.datetime):
#? datetime.datetime #? datetime.datetime
obj obj
def fooooo2(obj): def fooooo2(obj):
if isinstance(obj, datetime.datetime): if isinstance(obj, datetime.datetime):
return obj return obj
@@ -47,3 +50,20 @@ def fooooo2(obj):
#? int() datetime.datetime #? int() datetime.datetime
fooooo2('') fooooo2('')
# -----------------
# Names with multiple indices.
# -----------------
class Test():
def __init__(self, testing):
if isinstance(testing, str):
self.testing = testing
else:
self.testing = 10
def boo(self):
if isinstance(self.testing, str):
##? str()
self.testing