-
Notifications
You must be signed in to change notification settings - Fork 32
test: fix string compliance tests #23
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
Merged
Merged
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
5b1d1b1
test: fix string compliance tests
HemangChothani 0730997
fix: resolve conflict
HemangChothani 1dba2c0
test: add todo note to remove override method and resolve conflict
HemangChothani 55eebbf
Merge branch 'main' of https://github.com/cloudspannerecosystem/pytho…
HemangChothani de0732d
test: nit
HemangChothani 89ab8d5
Merge branch 'main' into fix_string_compliance_tests
larkee 210f938
test: remove select statements and resolve conflict
HemangChothani 9b52c20
test: nit
HemangChothani a08a154
fix: nit
HemangChothani 694ec7b
fix: remove override methods and add default value
HemangChothani 703f58c
fix: add default value MAX
HemangChothani 84782a0
Merge branch 'main' of https://github.com/cloudspannerecosystem/pytho…
HemangChothani 0c53c30
test: resolve conflict
HemangChothani 175535c
Merge branch 'main' of https://github.com/cloudspannerecosystem/pytho…
HemangChothani 611605c
Merge branch 'main' into fix_string_compliance_tests
AVaksman 6025d3a
Merge branch 'main' into fix_string_compliance_tests
HemangChothani 814b23a
Merge branch 'main' of https://github.com/cloudspannerecosystem/pytho…
HemangChothani ab715af
Merge branch 'fix_string_compliance_tests' of https://github.com/clou…
HemangChothani c4b9420
test: resolve conflict
HemangChothani 81bb2eb
test: resolve conflict
HemangChothani 01a85fe
test: fix nit
HemangChothani 6b0a402
Merge branch 'main' of https://github.com/cloudspannerecosystem/pytho…
HemangChothani 69cfd6b
test: add logic for additional escape ti fox the test
HemangChothani b58b718
Merge branch 'main' of https://github.com/cloudspannerecosystem/pytho…
HemangChothani bcf939c
test: add condition check for other data type
HemangChothani 3229b2c
Merge branch 'main' of https://github.com/cloudspannerecosystem/pytho…
HemangChothani 913710c
test: remove override tests
HemangChothani 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -86,6 +86,8 @@ | |
from sqlalchemy.testing.suite.test_select import OrderByLabelTest as _OrderByLabelTest | ||
from sqlalchemy.testing.suite.test_types import BooleanTest as _BooleanTest | ||
from sqlalchemy.testing.suite.test_types import IntegerTest as _IntegerTest | ||
from sqlalchemy.testing.suite.test_types import StringTest as _StringTest | ||
|
||
from sqlalchemy.testing.suite.test_types import _LiteralRoundTripFixture | ||
|
||
from sqlalchemy.testing.suite.test_types import ( # noqa: F401, F403 | ||
|
@@ -535,7 +537,6 @@ def _literal_round_trip(self, type_, input_, output, filter_=None): | |
) | ||
) | ||
conn.execute(ins) | ||
conn.execute("SELECT 1") | ||
|
||
if self.supports_whereclause: | ||
stmt = t.select().where(t.c.x == literal(value)) | ||
|
@@ -843,3 +844,38 @@ def test_nolength_binary(self): | |
@pytest.mark.skip("Spanner doesn't support quotes in table names.") | ||
class QuotedNameArgumentTest(_QuotedNameArgumentTest): | ||
pass | ||
|
||
|
||
class StringTest(_StringTest): | ||
def test_literal_backslashes(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the added |
||
""" | ||
SPANNER OVERRIDE: | ||
|
||
Cloud spanner supports prefixed backslash to escape non-alphanumeric characters | ||
in string. | ||
Override the method to add additional escape before using it to generate a SQL | ||
statement. See: | ||
https://cloud.google.com/spanner/docs/lexical#string_and_bytes_literals | ||
""" | ||
input_data = r"backslash one \\ backslash \\\\ two end" | ||
output_data = r"backslash one \ backslash \\ two end" | ||
|
||
self._literal_round_trip(String(40), [input_data], [output_data]) | ||
|
||
def test_literal_quoting(self): | ||
""" | ||
SPANNER OVERRIDE: | ||
|
||
The original test string is : \"""some 'text' hey "hi there" that's text\""" | ||
|
||
Spanner throws a syntax error for not representing non-alphanumeric characters | ||
in string as a raw string. | ||
Override the method to change input data into raw string. | ||
""" | ||
input_data = r"""some 'text' hey \"hi there\" that's text""" | ||
output_data = """some 'text' hey "hi there" that's text""" | ||
self._literal_round_trip(String(40), [input_data], [output_data]) | ||
|
||
@pytest.mark.skip("Spanner doesn't support non-ascii characters") | ||
def test_literal_non_ascii(self): | ||
pass |
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.
Locally, after removed the
test_literal_backslashes
andtest_literal_quoting
overrides, I was still getting failures.The following change fixes the errors: