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

fixed tests #42

Merged
merged 1 commit into from
Jul 17, 2024
Merged
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
20 changes: 15 additions & 5 deletions tests/pystackql_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,17 @@ def test_11a_execute_with_defaults_null_response(self):

@pystackql_test_setup(output='pandas')
def test_12_execute_with_pandas_output(self):
result = self.stackql.execute(aws_query)
# result = self.stackql.execute(aws_query)
result = self.stackql.execute(google_query)
is_valid_dataframe = isinstance(result, pd.DataFrame)
self.assertTrue(is_valid_dataframe, f"Result is not a valid DataFrame: {result}")
# Check datatypes of the columns
# expected_dtypes = {
# 'instance_type': 'object',
# 'num_instances': 'int64'
# }
expected_dtypes = {
'instance_type': 'str',
'status': 'object',
'num_instances': 'int64'
}
for col, expected_dtype in expected_dtypes.items():
Expand Down Expand Up @@ -281,14 +286,19 @@ def test_21_execute_server_mode_default_output(self):

@pystackql_test_setup(server_mode=True, output='pandas')
def test_22_execute_server_mode_pandas_output(self):
result = self.stackql.execute(aws_query)
# result = self.stackql.execute(aws_query)
result = self.stackql.execute(google_query)
is_valid_dataframe = isinstance(result, pd.DataFrame)
self.assertTrue(is_valid_dataframe, f"Result is not a valid DataFrame: {result}")
# Check datatypes of the columns
# expected_dtypes = {
# 'instance_type': 'object',
# 'num_instances': 'int64'
# }
expected_dtypes = {
'instance_type': 'str',
'status': 'object',
'num_instances': 'int64'
}
}
for col, expected_dtype in expected_dtypes.items():
actual_dtype = result[col].dtype
self.assertEqual(actual_dtype, expected_dtype, f"Column '{col}' has dtype '{actual_dtype}' but expected '{expected_dtype}'")
Expand Down
Loading