You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/01/20 22:32:24 UTC

[GitHub] [beam] benWize commented on a change in pull request #16154: [BEAM-12572] Run python examples on multiple runners

benWize commented on a change in pull request #16154:
URL: https://github.com/apache/beam/pull/16154#discussion_r789201448



##########
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've tested it several times, and it always produces the same result order




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org