Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions python/jupytergis_lab/jupytergis_lab/notebook/gis_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import json
import logging
import os
from pathlib import Path
from typing import Any, Dict, List, Literal, Optional, Union
from uuid import uuid4
Expand Down Expand Up @@ -63,6 +64,11 @@ def __init__(

comm_metadata = GISDocument._path_to_comm(path)

# Create an empty project file if it does not exist
if comm_metadata["path"] and not os.path.isfile(comm_metadata["path"]):
with open(comm_metadata["path"], "w") as fd:
fd.write("{}")

ydoc = Doc()

super().__init__(
Expand Down
18 changes: 18 additions & 0 deletions python/jupytergis_lab/jupytergis_lab/notebook/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
import os
import unittest

from jupytergis_lab import GISDocument


class ProjectCreation(unittest.TestCase):
filename = "test.jgis"

def setUp(self):
if os.path.isfile(self.filename):
os.remove(self.filename)

def tearDown(self):
if os.path.isfile(self.filename):
os.remove(self.filename)

def test_creation(self):
self.doc = GISDocument(self.filename)

assert os.path.isfile(self.filename)


class VectorTileTests(unittest.TestCase):
def setUp(self):
self.doc = GISDocument()
Expand Down
Loading