Skip to content

Commit 5283d11

Browse files
committed
Fix text.
1 parent 542da60 commit 5283d11

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

sdks/python/apache_beam/io/external/xlang_jdbcio_it_test.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@
3636
from apache_beam.testing.test_pipeline import TestPipeline
3737
from apache_beam.testing.util import assert_that
3838
from apache_beam.testing.util import equal_to
39+
from apache_beam.typehints.schemas import FixedBytes
40+
from apache_beam.typehints.schemas import FixedString
3941
from apache_beam.typehints.schemas import LogicalType
4042
from apache_beam.typehints.schemas import MillisInstant
43+
from apache_beam.typehints.schemas import VariableBytes
4144
from apache_beam.utils.timestamp import Timestamp
4245

4346
# pylint: disable=wrong-import-order, wrong-import-position, ungrouped-imports
@@ -258,7 +261,7 @@ def test_xlang_jdbc_read_with_explicit_schema(self, database):
258261
JdbcTestRow(
259262
i,
260263
i + 0.1,
261-
f'Test{i}',
264+
f'Test{i}' + ' ' * (10 - len(f'Test{i}')),
262265
f'Test{i}',
263266
f'Test{i}'.encode(),
264267
f'Test{i}'.encode(),
@@ -289,10 +292,10 @@ def test_xlang_jdbc_read_with_explicit_schema(self, database):
289292
[
290293
("renamed_id", int),
291294
("renamed_float", float),
292-
("renamed_char", str),
295+
("renamed_char", FixedString(10)),
293296
("renamed_varchar", str),
294-
("renamed_bytes", bytes),
295-
("renamed_varbytes", bytes),
297+
("renamed_bytes", FixedBytes(10)),
298+
("renamed_varbytes", VariableBytes(10)),
296299
("renamed_timestamp", Timestamp),
297300
("renamed_decimal", Decimal),
298301
("renamed_date", datetime.date),
@@ -306,6 +309,7 @@ def test_xlang_jdbc_read_with_explicit_schema(self, database):
306309

307310
expected_row = []
308311
for row in inserted_rows:
312+
f_char = row.f_char + ' ' * (10 - len(row.f_char))
309313
if database != 'postgres':
310314
# padding expected results for binary fields
311315
f_bytes = row.f_bytes + b'\0' * (10 - len(row.f_bytes))
@@ -316,7 +320,7 @@ def test_xlang_jdbc_read_with_explicit_schema(self, database):
316320
CustomSchemaRow(
317321
row.f_id,
318322
row.f_float,
319-
row.f_char + ' ' * (10 - len(row.f_char)),
323+
f_char,
320324
row.f_varchar,
321325
f_bytes,
322326
row.f_bytes,
@@ -333,15 +337,8 @@ def custom_equals(expected, actual):
333337
expected.renamed_id == actual.renamed_id and
334338
expected.renamed_float == actual.renamed_float and
335339
expected.renamed_char == actual.renamed_char and
336-
expected.renamed_varchar == actual.renamed_varchar and (
337-
expected.renamed_bytes == actual.renamed_bytes or
338-
# Handle potential padding differences in binary fields
339-
expected.renamed_bytes.rstrip(b'\0') ==
340-
actual.renamed_bytes.rstrip(b'\0')) and (
341-
expected.renamed_varbytes == actual.renamed_varbytes or
342-
# Handle potential padding differences in binary fields
343-
expected.renamed_varbytes.rstrip(b'\0') ==
344-
actual.renamed_varbytes.rstrip(b'\0')) and
340+
expected.renamed_varchar == actual.renamed_varchar and
341+
expected.renamed_bytes == actual.renamed_bytes and
345342
expected.renamed_timestamp == actual.renamed_timestamp and
346343
expected.renamed_decimal == actual.renamed_decimal and
347344
expected.renamed_date == actual.renamed_date and

0 commit comments

Comments
 (0)