-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_python.py
More file actions
52 lines (34 loc) · 1.05 KB
/
Copy pathtest_python.py
File metadata and controls
52 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
Test file for verifying the Python setup in Neovim.
"""
from typing import List
def add_numbers(a: int, b: int) -> int:
"""Add two numbers."""
return a + b
def process_items(items: List[str]) -> None:
"""Process a list of items."""
for item in items:
print(f"Processing: {item}")
# Type error - mypy should catch this
def broken_function(x: str) -> int:
return x # Error: type mismatch
# Unused import - ruff should warn
import os # noqa: F401
# Style error - ruff should fix this
def badly_formatted( x,y, z ):
return x+y+z
class Person:
"""Demonstration class."""
def __init__(self, name: str, age: int):
self.name = name
self.age = age
def greet(self) -> str:
return f"Hello, I'm {self.name}"
if __name__ == "__main__":
# Valid code
result = add_numbers(5, 10)
print(f"Result: {result}")
# Type error - pyright should catch this
wrong_result = add_numbers("hello", "world") # type: ignore
person = Person("Alice", 30)
print(person.greet())