Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrink10 committed Dec 31, 2023
1 parent 9f5e32c commit cf90110
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/basilisp/compiler_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import decimal
import importlib
import inspect
import logging
import os
import re
Expand Down Expand Up @@ -2320,6 +2321,28 @@ def test_single_arity_fn(self, lcompile: CompileFn, ns: runtime.Namespace):
assert callable(fvar.value)
assert "upper" == fvar.value("UPPER")

def test_single_arity_fn_sets_tag_ast(
self, lcompile: CompileFn, ns: runtime.Namespace
):
f = lcompile("(fn* ^python/str [^python/int i f] (str i f))")
sig = inspect.signature(f)
assert sig.return_annotation == str
params = {k.split("_")[0]: v for k, v in sig.parameters.items()}
assert params["i"].annotation == int
assert params["f"].annotation == inspect.Parameter.empty

def test_single_arity_fn_tag_ast_can_be_complex(
self, lcompile: CompileFn, ns: runtime.Namespace
):
f = lcompile(
'(fn* ^{:tag #(.lower "RETURN ANNO")} [^python/int i ^{:tag #(.upper "param anno")} f] (str i f))'
)
sig = inspect.signature(f)
assert sig.return_annotation() == "return anno"
params = {k.split("_")[0]: v for k, v in sig.parameters.items()}
assert params["i"].annotation == int
assert params["f"].annotation() == "PARAM ANNO"

class TestFunctionKeywordArgSupport:
def test_only_valid_kwarg_support_strategy(self, lcompile: CompileFn):
with pytest.raises(compiler.CompilerException):
Expand Down

0 comments on commit cf90110

Please sign in to comment.