Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6a7c50

Browse files
authored
Update Python katas to latest version of EduTools and Beam 2.41 (#23180)
* Remove automatically generated files The files *-remote-info.yaml are automatically generated by Edutools when a new version of the course is generated (e.g. new package created for offline distribution, or when a new version is uploaded to the courses marketplace). * Update Python katas to latest version of EduTools With the latest versions of the EduTools plugin, the previous katas stopped working, and this made it impossible to release new versions of the katas (e.g. after a new Beam release). The main change is in the testing method. EduTools now uses Python's unittest for checking the exercises. I have also re-organized some of the katas (e.g. windowing and triggers are now under the Streaming category), and updated the katas to Beam 2.41. * Add missing license headers
1 parent 31dab81 commit e6a7c50

269 files changed

Lines changed: 2468 additions & 1712 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,6 @@ website/www/yarn-error.log
133133
**/*.tfstate.*
134134
**/*.hcl
135135
**/*.tfvars
136+
137+
# Ignore Katas auto-generated files
138+
**/*-remote-info.yaml

learning/katas/python/Windowing/Adding Timestamp/lesson-info.yaml renamed to learning/katas/python/Common Transforms/Aggregation/Count/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,3 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818
#
19-
20-
content:
21-
- ParDo

learning/katas/python/Common Transforms/Aggregation/Count/task-info.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ files:
2525
- offset: 1134
2626
length: 31
2727
placeholder_text: TODO()
28-
- name: tests.py
28+
- name: tests/test_task.py
29+
visible: false
30+
- name: __init__.py
31+
visible: false
32+
- name: tests/__init__.py
2933
visible: false

learning/katas/python/Common Transforms/Aggregation/Count/task-remote-info.yaml

Lines changed: 0 additions & 2 deletions
This file was deleted.

learning/katas/python/Common Transforms/Aggregation/Count/task.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@
3131
(p | beam.Create(range(1, 11))
3232
| beam.combiners.Count.Globally()
3333
| LogElements())
34-

learning/katas/python/Common Transforms/Aggregation/Count/tests.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

learning/katas/python/Windowing/Fixed Time Window/lesson-info.yaml renamed to learning/katas/python/Common Transforms/Aggregation/Count/tests/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,3 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818
#
19-
20-
content:
21-
- Fixed Time Window
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
import unittest
21+
22+
from test_helper import test_is_not_empty, get_file_output
23+
24+
25+
class TestCase(unittest.TestCase):
26+
def test_not_empty(self):
27+
self.assertTrue(test_is_not_empty(), 'The output is empty')
28+
29+
def test_output(self):
30+
output = get_file_output(path='task.py')
31+
32+
answer = '10'
33+
34+
self.assertIn(answer, output, "Incorrect output. Use the Count combiner.")
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#

learning/katas/python/Common Transforms/Aggregation/Largest/task-info.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ files:
2525
- offset: 1150
2626
length: 29
2727
placeholder_text: TODO()
28-
- name: tests.py
28+
- name: tests/test_task.py
29+
visible: false
30+
- name: __init__.py
31+
visible: false
32+
- name: tests/__init__.py
2933
visible: false

0 commit comments

Comments
 (0)