Skip to content

Commit

Permalink
[cdd/tests/test_sqlalchemy/test_emit_sqlalchemy_utils.py] Increase te…
Browse files Browse the repository at this point in the history
…st coverage via `test_param_to_sqlalchemy_column_call_for_schema_comment` ; [cdd/__init__.py] Bump version so coverage badge gets updated
  • Loading branch information
SamuelMarks committed Sep 28, 2023
1 parent 527fc8f commit 6b011d9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cdd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from logging import getLogger as get_logger

__author__ = "Samuel Marks"
__version__ = "0.0.99rc11"
__version__ = "0.0.99rc12"
__description__ = (
"Open API to/fro routes, models, and tests. "
"Convert between docstrings, classes, methods, argparse, pydantic, and SQLalchemy."
Expand Down
33 changes: 33 additions & 0 deletions cdd/tests/test_sqlalchemy/test_emit_sqlalchemy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import ast
import json
from ast import (
Assign,
Call,
Expand Down Expand Up @@ -165,6 +166,38 @@ def test_param_to_sqlalchemy_column_call_when_foreign_key(self) -> None:
gold=node_fk_call,
)

def test_param_to_sqlalchemy_column_call_for_schema_comment(self) -> None:
"""Tests that SQLalchemy column is generated with schema as comment"""
run_ast_test(
self,
param_to_sqlalchemy_column_call(
(
"foo",
{
"doc": "",
"typ": "dict",
"ir": intermediate_repr_no_default_doc,
},
),
include_name=False,
),
gold=Call(
func=Name(id="Column", ctx=Load()),
args=[Name(id="JSON", ctx=Load())],
keywords=[
keyword(
arg="comment",
value=set_value(
"[schema={}]".format(
json.dumps(intermediate_repr_no_default_doc)
)
),
identifier=None,
)
],
),
)

def test_update_args_infer_typ_sqlalchemy_when_simple_array(self) -> None:
"""Tests that SQLalchemy can infer the typ from a simple array"""
args = []
Expand Down

0 comments on commit 6b011d9

Please sign in to comment.