Coverage for src\zapy\test\assertion.py: 100%

1 from typing import List

2

3 from .models import TestResult

4

5

6 def filter_failed_tests(test_result: List[TestResult]):

7 failed_tests = [

8 result

9 for result in test_result

10 if result['status'] in ("error", "failure")

11 ]

12 return failed_tests

13

14

15 class AssertTestResultMixin:

16

17 def assertZapyTestResults(self, test_result: List[TestResult]):

18 failed_tests = filter_failed_tests(test_result)

19 self.assertEqual([], failed_tests)

20

21

22 def assert_test_result_dict(test_result: List[TestResult]):

23 failed_tests = filter_failed_tests(test_result)

24 assert [] == failed_tests, stringify_error(failed_tests)

25

26 def stringify_error(error: List[TestResult]):

27 output = ''

28 for err in error:

29 output += f"Method: {err['method']}"

30 output += f"\n{err['traceback']}\n"

31 return output