Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/update unit tests #11

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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