-
Notifications
You must be signed in to change notification settings - Fork 48
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
TDL-14448 Numbertype falls to string for boolean values #73
Merged
namrata270998
merged 8 commits into
crest-work
from
TDL-14448-numbertype-falls-to-string-for-boolean
May 30, 2022
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ea27c26
initial commit
namrata270998 8262b7e
unittests for number transform
namrata270998 b7301eb
intgration test update
namrata270998 0bd8411
deleted test.py
namrata270998 a6b299e
resolve PR comments
namrata270998 0e01a40
Merge branch 'crest-work' of https://github.com/singer-io/tap-google-…
namrata270998 1381ac9
resolved cci failures
namrata270998 6eb2078
changed currency to string as it would now come as a string
namrata270998 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import unittest | ||
from tap_google_sheets.transform import transform_sheet_number_data | ||
|
||
class TestNumberTransform(unittest.TestCase): | ||
"""Verify that boolean values falls back as string""" | ||
def test_number_transform_boolean_as_string(self): | ||
"""Verify that boolean values falls back as string""" | ||
value = True | ||
transformed_data = transform_sheet_number_data(value, sheet_title='test-sheet', col_name='test-column', col_letter='col', row_num=1, col_type='numberType') | ||
self.assertIsInstance(transformed_data, str) | ||
self.assertEqual(transformed_data, "True") | ||
|
||
def test_number_transform_int_value_as_int(self): | ||
"""Verify that int values falls back as type int""" | ||
value = 1 | ||
transformed_data = transform_sheet_number_data(value, sheet_title='test-sheet', col_name='test-column', col_letter='col', row_num=1, col_type='numberType') | ||
self.assertIsInstance(transformed_data, int) | ||
self.assertEqual(transformed_data, 1) | ||
|
||
def test_number_transform_float_value_as_float(self): | ||
"""Verify that float values falls back as type float""" | ||
value = 1.0 | ||
transformed_data = transform_sheet_number_data(value, sheet_title='test-sheet', col_name='test-column', col_letter='col', row_num=1, col_type='numberType') | ||
self.assertIsInstance(transformed_data, float) | ||
self.assertEqual(transformed_data, 1.0) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, add an assertion for the value of transformed_data in all unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the assertion