Skip to content

Commit

Permalink
mypy: stricly type tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl authored and inducer committed Jan 10, 2025
1 parent afec7a2 commit 8f70149
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions test/test_identical_symbols.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from types import ModuleType

import pytest


def make_greet_mod(greeting):
def make_greet_mod(greeting: str) -> ModuleType:
from cgen import (
Block,
Const,
Expand All @@ -19,7 +21,7 @@ def make_greet_mod(greeting):
mod.add_function(
FunctionBody(
FunctionDeclaration(Const(Pointer(Value("char", "greet"))), []),
Block([Statement('return "%s"' % greeting)])
Block([Statement(f'return "{greeting}"')])
))

from codepy.toolchain import guess_toolchain
Expand All @@ -29,7 +31,7 @@ def make_greet_mod(greeting):
@pytest.mark.xfail(reason="You probably don't have "
"Boost.Python installed where I am looking for it, "
"and that's OK.")
def test_identical_symbols():
def test_identical_symbols() -> None:
us = make_greet_mod("Hi there")
aussie = make_greet_mod("G'day")

Expand Down
2 changes: 1 addition & 1 deletion test/test_two_stage_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from codepy.toolchain import guess_toolchain


def test():
def test() -> None:
toolchain = guess_toolchain()

module_code = """
Expand Down

0 comments on commit 8f70149

Please sign in to comment.