Skip to content

Commit

Permalink
chore: better doc strings
Browse files Browse the repository at this point in the history
  • Loading branch information
tekumara committed Jul 30, 2023
1 parent 8864c3e commit 53f798e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions fakesnow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ def patch(
- snowflake.connector.pandas_tools.write_pandas
Args:
extra_targets (Sequence[types.ModuleType], optional): Extra targets to patch. Defaults to [].
auto_create_database
extra_targets (str | Sequence[str], optional): Extra targets to patch. Defaults to [].
create_database_on_connect (bool, optional): Create database if provided in connection. Defaults to True.
create_schema_on_connect (bool, optional): Create schema if provided in connection. Defaults to True.
Allows extra targets beyond the standard snowflake.connector targets to be patched. Needed because we cannot
patch definitions, only usages, see https://docs.python.org/3/library/unittest.mock.html#where-to-patch
Expand Down Expand Up @@ -65,10 +66,8 @@ def patch(
for im in std_targets + list([extra_targets] if isinstance(extra_targets, str) else extra_targets):
module_name = ".".join(im.split(".")[:-1])
fn_name = im.split(".")[-1]
module = sys.modules.get(module_name)
if not module:
# module may not be loaded yet, try to import it
module = importlib.import_module(module_name)
# get module or try to import it if not loaded yet
module = sys.modules.get(module_name) or importlib.import_module(module_name)
fn = module.__dict__.get(fn_name)
assert fn, f"No module var {im}"

Expand Down
2 changes: 1 addition & 1 deletion tests/test_fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_describe(cur: snowflake.connector.cursor.SnowflakeCursor):


def test_describe_info_schema(cur: snowflake.connector.cursor.SnowflakeCursor):
# tests we can handle the column types returned from the info schema, which are created by duckdb
# test we can handle the column types returned from the info schema, which are created by duckdb
# and so don't go through our transforms
cur.execute("select column_name, ordinal_position from information_schema.columns")
# fmt: off
Expand Down

0 comments on commit 53f798e

Please sign in to comment.