Skip to content

Commit c421167

Browse files
committed
tests: update python tests
1 parent a4dbd5b commit c421167

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

testdata/pyfileimports/main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# Copyright 2025 CloudWeGo Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
# fmt: off
117
import abc
218
import base64
319

testdata/pythonoperator/main.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2025 CloudWeGo Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
class A:
17+
def __init__(self):
18+
self.value = 10
19+
20+
def get_value(self):
21+
return self.value
22+
23+
def __add__(self, other):
24+
if isinstance(other, A):
25+
return A(self.value + other.value)
26+
return NotImplemented
27+
28+
29+
def main():
30+
a1 = A()
31+
a2 = A()
32+
33+
print("Value of a1:", a1.get_value())
34+
print("Value of a2:", a2.get_value())
35+
36+
# There should be a dependency from main to A.__add__
37+
a3 = a1 + a2
38+
print("Value of a3 (a1 + a2):", a3.get_value())

0 commit comments

Comments
 (0)