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 imports #26

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Updated connection
lukasnolte committed Aug 5, 2024
commit 011d883922d6c996be3f16c60627f4087d30508e
10 changes: 5 additions & 5 deletions tests/test_public_sheet.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ def expected_df() -> pd.DataFrame:
def test_read_public_sheet(expected_df: pd.DataFrame):
url = "https://docs.google.com/spreadsheets/d/1JDy9md2VZPz4JbYtRPJLs81_3jUK47nx6GYQjgU8qNY/edit"

conn = st.experimental_connection("connection_name", type=GSheetsConnection)
conn = st.connection("connection_name", type=GSheetsConnection)

df = conn.read(spreadsheet=url, usecols=[0, 1])

@@ -31,7 +31,7 @@ def test_read_public_sheet(expected_df: pd.DataFrame):
def test_query_public_sheet():
url = "https://docs.google.com/spreadsheets/d/1JDy9md2VZPz4JbYtRPJLs81_3jUK47nx6GYQjgU8qNY/edit"

conn = st.experimental_connection("connection_name", type=GSheetsConnection)
conn = st.connection("connection_name", type=GSheetsConnection)

df = conn.query("select date from my_table where births = 265775", spreadsheet=url)

@@ -45,7 +45,7 @@ def test_query_worksheet_public_sheet():
1585633377 # Example 2, note that this is the gid, not the worksheet name
)

conn = st.experimental_connection("connection_name", type=GSheetsConnection)
conn = st.connection("connection_name", type=GSheetsConnection)

df = conn.query(
"select date from my_table where births = 1000000",
@@ -65,15 +65,15 @@ def test_query_worksheet_public_sheet():

@patch("builtins.open", mock_open(read_data=secrets_contents))
def test_secrets_contents(expected_df):
conn = st.experimental_connection("test_connection_name", type=GSheetsConnection)
conn = st.connection("test_connection_name", type=GSheetsConnection)

df = conn.read()

assert_frame_equal(df.head(), expected_df)


def test_no_secrets_contents():
conn = st.experimental_connection("other_connection_name", type=GSheetsConnection)
conn = st.connection("other_connection_name", type=GSheetsConnection)

with pytest.raises(ValueError):
conn.read()