Commit 23a1c1d8 authored by Sven Brauch's avatar Sven Brauch

Tests for the "change local type" feature of the correction files

parent b4dba674
......@@ -3,3 +3,13 @@
def function_global_func():
returns = int()
class class_some_class():
def function___init__(self):
l_bar = float()
def function_member_func1(self):
l_baz = [3]
def function_member_func2(self):
returns = [float()]
def global_func():
return
\ No newline at end of file
return
class some_class():
def __init__(self):
bar = None
self.foo = bar
def member_func1(self):
baz = None
return baz
def member_func2(self):
baz = None
return baz
\ No newline at end of file
......@@ -115,17 +115,12 @@ void PyDUChainTest::init()
kDebug() << "Searching for python files in " << assetModuleDir.absolutePath();
// sorry, but this is the easiest way to do it ;)
QList<KUrl> oldPaths = Helper::cachedSearchPaths;
Helper::cachedSearchPaths = QList<KUrl>() << KUrl(assetsDir.absolutePath());
QList<QString> foundfiles = FindPyFiles(assetModuleDir);
QString correctionFileDir = KStandardDirs::locate("data", "kdevpythonsupport/correction_files/");
KUrl correctionFileUrl = KUrl(correctionFileDir + "testCorrectionFiles/example.py");
correctionFileUrl.cleanPath();
foundfiles.prepend(correctionFileUrl.path());
Helper::cachedSearchPaths = oldPaths;
foreach(const QString filename, foundfiles) {
kDebug() << "Parsing asset: " << filename;
......@@ -1125,5 +1120,11 @@ void PyDUChainTest::testCorrectionFiles_data()
QTest::newRow("global_scope_return_type") << "from testCorrectionFiles.example import global_func\n"
"checkme = global_func()" << "int";
QTest::newRow("class_scope_assign_local") << "from testCorrectionFiles.example import some_class\n"
"a = some_class(); checkme = a.foo" << "float";
QTest::newRow("class_scope_return_local") << "from testCorrectionFiles.example import some_class\n"
"a = some_class(); checkme = a.member_func1()" << "list of int";
QTest::newRow("class_scope_return") << "from testCorrectionFiles.example import some_class\n"
"a = some_class(); checkme = a.member_func2()" << "list of float";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment