benWize commented on a change in pull request #16154:
URL: https://github.com/apache/beam/pull/16154#discussion_r794953967
##########
File path: sdks/python/apache_beam/examples/complete/autocomplete_test.py
##########
@@ -71,6 +79,33 @@ def test_autocomplete_it(self):
assert_that(checksum, equal_to([self.KINGLEAR_HASH_SUM]))
+ @pytest.mark.examples_postcommit
+ def test_basics(self):
+ EXPECTED_PREFIXES = "t: [(3, 'to'), (2, 'this'), (1, 'that')]\n" \
+ "th: [(2, 'this'), (1, 'that')]\n" \
+ "thi: [(2, 'this')]\n" \
+ "this: [(2, 'this')]\n" \
+ "tha: [(1, 'that')]\n" \
+ "that: [(1, 'that')]\n" \
+ "to: [(3, 'to')]"
+
+ # Setup the files with expected content.
+ temp_folder = tempfile.mkdtemp()
+ self.create_file(
+ os.path.join(temp_folder, 'input.txt'), ' '.join(self.WORDS))
+ autocomplete.run([
+ '--input=%s/input.txt' % temp_folder,
+ '--output',
+ os.path.join(temp_folder, 'result')
+ ],
+ save_main_session=False)
+
+ # Load result file and compare.
+ with open_shards(os.path.join(temp_folder, 'result-*-of-*')) as
result_file:
+ result = result_file.read().strip()
+
+ self.assertEqual(result, EXPECTED_PREFIXES)
Review comment:
I sorted the result
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]