Skip to content
Open
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@ __pycache__
.venv
dist
relationalize.egg-info
/.idea/inspectionProfiles/profiles_settings.xml
/.idea/.gitignore
/.idea/aws.xml
/.idea/misc.xml
/.idea/modules.xml
/.idea/relationalize.iml
/.idea/vcs.xml
9 changes: 5 additions & 4 deletions test/schema.test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import unittest
from copy import deepcopy

Expand All @@ -16,7 +17,7 @@
CASE_5 = {"1": "foobar"}

CASE_1_DDL = """
CREATE TABLE "public"."test" (
CREATE TABLE IF NOT EXISTS "public"."test" (
"1" BIGINT
, "2" VARCHAR(65535)
, "3" BOOLEAN
Expand All @@ -25,7 +26,7 @@
""".strip()

CASE_2_DDL = """
CREATE TABLE "public"."test" (
CREATE TABLE IF NOT EXISTS "public"."test" (
"1_int" BIGINT
, "1_str" VARCHAR(65535)
, "2_float" FLOAT
Expand Down Expand Up @@ -121,14 +122,14 @@ def test_convert_object_choice(self):
def test_generate_ddl_no_choice(self):
schema1 = Schema()
schema1.read_object(CASE_1)
self.assertEqual(CASE_1_DDL, schema1.generate_ddl("test"))
self.assertEqual(re.sub(r'\s+', ' ', CASE_1_DDL), re.sub(r'\s+', ' ', schema1.generate_ddl("test")))

def test_generate_ddl_choice(self):
schema1 = Schema()
schema1.read_object(CASE_1)
schema1.read_object(CASE_2)

self.assertEqual(CASE_2_DDL, schema1.generate_ddl("test"))
self.assertEqual(re.sub(r'\s+', ' ', CASE_2_DDL), re.sub(r'\s+', ' ', schema1.generate_ddl("test")))

def test_none_cases(self):
schema1 = Schema()
Expand Down