Search in sources :

Example 6 with IpnbFile

use of org.jetbrains.plugins.ipnb.format.IpnbFile in project intellij-community by JetBrains.

the class JsonParserTest method testFile.

public void testFile() throws IOException {
    final String fileName = "testData/SymPy.ipynb";
    final String fileText = IpnbTestCase.getFileText(fileName);
    final IpnbFile ipnbFile = IpnbParser.parseIpnbFile(fileText, new LightVirtualFile());
    assertNotNull(ipnbFile);
    assertEquals(31, ipnbFile.getCells().size());
}
Also used : LightVirtualFile(com.intellij.testFramework.LightVirtualFile) IpnbFile(org.jetbrains.plugins.ipnb.format.IpnbFile)

Example 7 with IpnbFile

use of org.jetbrains.plugins.ipnb.format.IpnbFile in project intellij-community by JetBrains.

the class JsonParserTest method testMarkdownCells.

public void testMarkdownCells() throws IOException {
    final String fileName = "testData/SymPy.ipynb";
    final String fileText = IpnbTestCase.getFileText(fileName);
    final IpnbFile ipnbFile = IpnbParser.parseIpnbFile(fileText, new LightVirtualFile());
    assertNotNull(ipnbFile);
    final List<IpnbCell> cells = ipnbFile.getCells();
    Iterables.removeIf(cells, new Predicate<IpnbCell>() {

        @Override
        public boolean apply(IpnbCell cell) {
            return !(cell instanceof IpnbMarkdownCell);
        }
    });
    assertEquals(7, cells.size());
}
Also used : IpnbCell(org.jetbrains.plugins.ipnb.format.cells.IpnbCell) IpnbMarkdownCell(org.jetbrains.plugins.ipnb.format.cells.IpnbMarkdownCell) LightVirtualFile(com.intellij.testFramework.LightVirtualFile) IpnbFile(org.jetbrains.plugins.ipnb.format.IpnbFile)

Aggregations

LightVirtualFile (com.intellij.testFramework.LightVirtualFile)7 IpnbFile (org.jetbrains.plugins.ipnb.format.IpnbFile)7 IpnbCell (org.jetbrains.plugins.ipnb.format.cells.IpnbCell)4 IpnbCodeCell (org.jetbrains.plugins.ipnb.format.cells.IpnbCodeCell)3 IpnbMarkdownCell (org.jetbrains.plugins.ipnb.format.cells.IpnbMarkdownCell)2 IpnbOutputCell (org.jetbrains.plugins.ipnb.format.cells.output.IpnbOutputCell)2