}
public void testGetInsideParentesis() throws Exception {
String s = "def m1(self, a, b)";
doc = new Document(s);
ps = new PySelection(doc, new TextSelection(doc, 0, 0));
List<String> insideParentesisToks = ps.getInsideParentesisToks(false).o1;
assertEquals(2, insideParentesisToks.size());
assertEquals("a", insideParentesisToks.get(0));
assertEquals("b", insideParentesisToks.get(1));
s = "def m1(self, a, b, )";
doc = new Document(s);
ps = new PySelection(doc, new TextSelection(doc, 0, 0));
insideParentesisToks = ps.getInsideParentesisToks(false).o1;
assertEquals(2, insideParentesisToks.size());
assertEquals("a", insideParentesisToks.get(0));
assertEquals("b", insideParentesisToks.get(1));
s = "def m1(self, a, b=None)";
doc = new Document(s);
ps = new PySelection(doc, new TextSelection(doc, 0, 0));
insideParentesisToks = ps.getInsideParentesisToks(true).o1;
assertEquals(3, insideParentesisToks.size());
assertEquals("self", insideParentesisToks.get(0));
assertEquals("a", insideParentesisToks.get(1));
assertEquals("b", insideParentesisToks.get(2));
s = "def m1(self, a, b=None)";
doc = new Document(s);
ps = new PySelection(doc, new TextSelection(doc, 0, 0));
insideParentesisToks = ps.getInsideParentesisToks(false).o1;
assertEquals(2, insideParentesisToks.size());
assertEquals("a", insideParentesisToks.get(0));
assertEquals("b", insideParentesisToks.get(1));
//Note: as Python dropped this support, so did PyDev: in this situation (b,c) is ignored.
s = "def m1(self, a, (b,c) )";
doc = new Document(s);
ps = new PySelection(doc, new TextSelection(doc, 0, 0));
insideParentesisToks = ps.getInsideParentesisToks(false).o1;
assertEquals(1, insideParentesisToks.size());
assertEquals("a", insideParentesisToks.get(0));
s = "def m1(self, a, b, \nc,\nd )";
doc = new Document(s);
ps = new PySelection(doc, new TextSelection(doc, 0, 0));
insideParentesisToks = ps.getInsideParentesisToks(false).o1;
assertEquals(4, insideParentesisToks.size());
assertEquals("a", insideParentesisToks.get(0));
assertEquals("b", insideParentesisToks.get(1));
assertEquals("c", insideParentesisToks.get(2));
assertEquals("d", insideParentesisToks.get(3));
s = "def m1(self, a=(1,2))";
doc = new Document(s);
ps = new PySelection(doc, new TextSelection(doc, 0, 0));
insideParentesisToks = ps.getInsideParentesisToks(false).o1;
assertEquals(1, insideParentesisToks.size());
assertEquals("a", insideParentesisToks.get(0));
}