Skip to content
This repository has been archived by the owner on Apr 21, 2021. It is now read-only.

Add schema generation test. #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
24 changes: 24 additions & 0 deletions tests/test_generate_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from __future__ import annotations

from typing import List

from pydiggy import Node, reverse

def test_generate_schema():
class Map(Node):
pass

class Region(Node):
map: 'Map' = reverse(name="territories", many=True)
name: str
borders: List['Region']

schema, unknown = Node._generate_schema()

expected = """Map: bool @index(bool) .
Region: bool @index(bool) .
_type: string .
name: string .
uid: int ."""

assert schema == expected