Skip to content

Commit 8f375a3

Browse files
authored
Merge pull request #7 from pomponchik/develop
0.0.7
2 parents 95e10c9 + 1aebb4b commit 8f375a3

5 files changed

Lines changed: 479 additions & 15 deletions

File tree

docs/assets/logo_3.png

17.1 KB
Loading

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "transfunctions"
7-
version = "0.0.6"
7+
version = "0.0.7"
88
authors = [
99
{ name="Evgeniy Blinov", email="zheni-b@yandex.ru" },
1010
]

tests/units/decorators/test_superfunction.py

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
"""
1212
Что нужно проверить:
1313
14-
2. При попытке вызвать без тильды суперфункцию, в которой есть return или raise, должно подниматься исключение, причем .
1514
3. Трейсбек исключения из п. 2 информативен (т.е. содержит конкретную строчку кода, и короткий). Но есть возможность увидеть полный "настоящий" трейсбек.
1615
4. Базовые кейсы работают в глобальном скоупе.
17-
6. С синтаксисом ~ нормально поднимаются исключения.
1816
1917
Что проверено:
2018
2119
1. Все базово работает без аргументов и с аргументами, для обычных, асинк и генераторных функций.
2220
5. С использованием синтаксиса ~ для вызова обычных функций можно возвращать значения, с аргументами и без.
21+
2. При попытке вызвать без тильды суперфункцию, в которой есть return или raise, должно подниматься исключение.
22+
6. С синтаксисом ~ нормально поднимаются исключения.
2323
"""
2424

2525

@@ -382,28 +382,60 @@ def test_there_are_no_exceptions_if_not_tilde_mode_and_in_function_is_empty_retu
382382
def function():
383383
with async_context:
384384
return
385-
pass
386385

387386

388387
def test_there_are_no_exceptions_if_not_tilde_mode_and_in_function_is_return_true_in_async_block():
389388
@superfunction(tilde_syntax=False)
390389
def function():
391390
with async_context:
392391
return True
393-
pass
394392

395393

396394
def test_there_are_no_exceptions_if_not_tilde_mode_and_in_function_is_empty_return_in_generator_block():
397395
@superfunction(tilde_syntax=False)
398396
def function():
399397
with generator_context:
400398
return
401-
pass
402399

403400

404401
def test_there_are_no_exceptions_if_not_tilde_mode_and_in_function_is_return_true_in_generator_block():
405402
@superfunction(tilde_syntax=False)
406403
def function():
407404
with generator_context:
408405
return True
409-
pass
406+
407+
408+
def test_async_function_with_all_content_in_generator_context():
409+
@superfunction
410+
def function():
411+
with generator_context:
412+
return True
413+
414+
assert run(function()) is None
415+
416+
417+
def test_async_function_with_all_content_in_sync_context():
418+
@superfunction
419+
def function():
420+
with sync_context:
421+
return True
422+
423+
assert run(function()) is None
424+
425+
426+
def test_usual_tilde_function_with_all_content_in_generator_context():
427+
@superfunction
428+
def function():
429+
with generator_context:
430+
return True
431+
432+
assert ~function() is None
433+
434+
435+
def test_usual_tilde_function_with_all_content_in_async_context():
436+
@superfunction
437+
def function():
438+
with async_context:
439+
return True
440+
441+
assert ~function() is None

0 commit comments

Comments
 (0)