Coverage for test/click/click_test.py: 86%

14 statements  

« prev     ^ index     » next       coverage.py v7.3.1, created at 2023-09-22 17:59 +0530

1"""Click test cases.""" 

2import json 

3 

4from typing_extensions import Self 

5 

6from src.click_opt.cli_options import CliOptions 

7 

8 

9class TestClick: 

10 """Test clock option.""" 

11 

12 @staticmethod 

13 def is_json(myjson: str) -> bool: 

14 """Check if a string is json.""" 

15 try: 

16 json.loads(myjson) 

17 except ValueError: 

18 return False 

19 return True 

20 

21 def test_str_method_print_json(self: Self, cli_options: CliOptions) -> None: 

22 """Test str method print json.""" 

23 str_method = str(cli_options) 

24 assert TestClick.is_json(str_method) is True