Test resolution collision (submodule vs __init__.py)

This commit is contained in:
Dmitry Cheryasov
2010-09-23 13:09:54 +03:00
parent 92bb78dff8
commit 61dcbf0409
5 changed files with 29 additions and 0 deletions
@@ -0,0 +1,6 @@
# here we export boo() and not module boo
from boo import boo
b = boo()
# <ref>
@@ -0,0 +1,5 @@
# the typical way to provide a default implementation;
# see curses.has_key()
class boo(object):
pass
@@ -0,0 +1,4 @@
# we import a value
from boo import BOO
print(BOO)
# <ref>
@@ -0,0 +1 @@
BOO = "only kidding"
@@ -131,6 +131,19 @@ public class PyMultiFileResolveTest extends PyResolveTestCase {
assertEquals("silicate", ((PyStringLiteralExpression)value).getStringValue());
}
public void testModuleValueCollision() throws Exception {
PsiElement element = doResolve();
assertTrue(element instanceof PyTargetExpression);
PsiElement value = ((PyTargetExpression)element).findAssignedValue();
assertEquals("only kidding", ((PyStringLiteralExpression)value).getStringValue());
}
public void testModuleClassCollision() throws Exception {
PsiElement element = doResolve();
assertTrue(element instanceof PyClass);
assertEquals("boo", ((PyClass)element).getName());
}
public void testDirectoryVsClass() throws Exception {
assertResolvesTo(PyClass.class, "Context");
}