Skip to content

Commit 77a6002

Browse files
committed
make lispython dialect set __lang__; name the test function runtests
1 parent 1c4b76a commit 77a6002

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

unpythonic/dialects/lispython.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Lispython(Dialect):
2626

2727
def transform_ast(self, tree): # tree is an ast.Module
2828
with q as template:
29+
__lang__ = "Lispython" # noqa: F841, just provide it to user code.
2930
from unpythonic.syntax import (macros, tco, autoreturn, # noqa: F401, F811
3031
multilambda, quicklambda, namedlambda, f,
3132
let, letseq, letrec,

unpythonic/dialects/tests/test_lispython.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# -*- coding: utf-8 -*-
22
"""Test the Lispython dialect."""
33

4-
# See the `mcpyrate` dialects user manual:
5-
# https://github.com/Technologicat/mcpyrate/blob/master/doc/dialects.md
6-
74
from ...dialects import dialects, Lispython # noqa: F401
85

9-
# Can use macros, too.
106
from ...syntax import macros, continuations, call_cc # noqa: F401
117

128
# `unpythonic` is effectively `lispython`'s stdlib; not everything gets imported by default.
@@ -21,7 +17,9 @@
2117

2218
# TODO: use the test framework
2319

24-
def main():
20+
def runtests():
21+
print(f"Hello from {__lang__}!") # noqa: F821, the dialect template defines it.
22+
2523
assert prod((2, 3, 4)) == 24 # noqa: F821, bye missing battery, hello new dialect builtin
2624
assert foldl(mul, 1, (2, 3, 4)) == 24
2725

@@ -131,4 +129,4 @@ def doit():
131129
print("All tests PASSED")
132130

133131
if __name__ == '__main__':
134-
main()
132+
runtests()

0 commit comments

Comments
 (0)