Improved quickdoc tests.

This commit is contained in:
Dmitry Cheryasov
2010-09-05 14:20:21 +03:00
parent 6b3f853d60
commit a1e52d975b
6 changed files with 12 additions and 36 deletions
+1 -1
View File
@@ -1 +1 @@
<html><body><code><small>class <a href="psi_element://#class#">A</a>(<a href="psi_element://#parent#object">object</a>)</small><br><br>@<i>property</i><br>def <b>x</b>(self)<br>Inferred&nbsp;return&nbsp;type:&nbsp;int<br>Does&nbsp;things&nbsp;to&nbsp;X</code></body></html>
<html><body>property <b><code>x</code></b> of class <a href="psi_element://#class#">A</a>(<a href="psi_element://#parent#object">object</a>)<code><br><br>@<i>property</i><br>def <b>x</b>(self)<br>Inferred&nbsp;return&nbsp;type:&nbsp;int<br>Does&nbsp;things&nbsp;to&nbsp;X</code><small><br><br>Getter of property</small><br></body></html>
+1 -10
View File
@@ -1,10 +1 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
<html><body>property <b><code>x</code></b> of class <a href="psi_element://#class#">A</a>(<a href="psi_element://#parent#object">object</a>)<code><br><br>def <b>__getX</b>(self)<br>Inferred&nbsp;return&nbsp;type:&nbsp;unknown<br>Doc&nbsp;of&nbsp;getter</code><small><br><br>Deleter of property</small><br></body></html>
+2 -1
View File
@@ -4,4 +4,5 @@
return self.__x
x = property(fdel=__getX)
del A().<the_ref>x
a = A()
del a.<the_ref>x
+1 -10
View File
@@ -1,10 +1 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
<html><body>property <b><code>x</code></b> of class <a href="psi_element://#class#">A</a>(<a href="psi_element://#parent#object">object</a>)<code><br><br>def <b>__getX</b>(self)<br>Inferred&nbsp;return&nbsp;type:&nbsp;unknown<br>Doc&nbsp;of&nbsp;getter</code><small><br><br>Getter of property</small><br></body></html>
+1 -10
View File
@@ -1,10 +1 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
<html><body>property <b><code>x</code></b> of class <a href="psi_element://#class#">A</a>(<a href="psi_element://#parent#object">object</a>)<code><br><br>def <b>__getX</b>(self,&nbsp;x)<br>Inferred&nbsp;return&nbsp;type:&nbsp;None<br>Doc&nbsp;of&nbsp;getter</code><small><br><br>Setter of property</small><br></body></html>
@@ -46,7 +46,8 @@ public class PyQuickDocTest extends LightMarkedTestCase {
private void checkRefDocPair() throws Exception {
Map<String, PsiElement> marks = loadTest();
assertEquals(2, marks.size());
PsiElement doc_elt = marks.get("<the_doc>").getParent(); // ident -> expr
final PsiElement original_elt = marks.get("<the_doc>");
PsiElement doc_elt = original_elt.getParent(); // ident -> expr
assertTrue(doc_elt instanceof PyStringLiteralExpression);
String doc_text = ((PyStringLiteralExpression)doc_elt).getStringValue();
assertNotNull(doc_text);
@@ -55,14 +56,15 @@ public class PyQuickDocTest extends LightMarkedTestCase {
final PyDocStringOwner doc_owner = (PyDocStringOwner)((PyReferenceExpression)ref_elt).getReference().resolve();
assertEquals(doc_elt, doc_owner.getDocStringExpression());
checkByHTML(myProvider.generateDoc(doc_owner, null));
checkByHTML(myProvider.generateDoc(doc_owner, original_elt));
}
private void checkHTMLOnly() throws Exception {
Map<String, PsiElement> marks = loadTest();
PsiElement ref_elt = marks.get("<the_ref>").getParent(); // ident -> expr
final PsiElement original_elt = marks.get("<the_ref>");
PsiElement ref_elt = original_elt.getParent(); // ident -> expr
final PyDocStringOwner doc_owner = (PyDocStringOwner)((PyReferenceExpression)ref_elt).getReference().resolve();
checkByHTML(myProvider.generateDoc(doc_owner, null));
checkByHTML(myProvider.generateDoc(doc_owner, original_elt));
}
public void testDirectFunc() throws Exception {