Coverage for tests/test_000_frigid/test_900_installers.py: 100%

24 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-01-24 04:09 +0000

1# vim: set filetype=python fileencoding=utf-8: 

2# -*- coding: utf-8 -*- 

3 

4#============================================================================# 

5# # 

6# Licensed under the Apache License, Version 2.0 (the "License"); # 

7# you may not use this file except in compliance with the License. # 

8# You may obtain a copy of the License at # 

9# # 

10# http://www.apache.org/licenses/LICENSE-2.0 # 

11# # 

12# Unless required by applicable law or agreed to in writing, software # 

13# distributed under the License is distributed on an "AS IS" BASIS, # 

14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # 

15# See the License for the specific language governing permissions and # 

16# limitations under the License. # 

17# # 

18#============================================================================# 

19 

20 

21''' Assert correct function of installers. ''' 

22 

23# pylint: disable=no-member,undefined-variable 

24# ruff: noqa: F821 

25 

26 

27from . import PACKAGE_NAME, cache_import_module 

28 

29 

30MODULE_QNAME = f"{PACKAGE_NAME}.installers" 

31 

32 

33def test_100_install_one_with_default( ): 

34 ''' Install_one function adds one to builtins by default. ''' 

35 module = cache_import_module( MODULE_QNAME ) 

36 module.install( ) 

37 assert ( 42, ) == one( 42 ) 

38 import builtins 

39 del builtins.one 

40 

41 

42def test_101_install_one_with_name( ): 

43 ''' Install_one function accepts custom name. ''' 

44 module = cache_import_module( MODULE_QNAME ) 

45 module.install( 'single' ) 

46 assert ( 42, ) == single( 42 ) 

47 import builtins 

48 del builtins.single 

49 

50 

51def test_102_install_one_skip( ): 

52 ''' Install_one function accepts None to skip. ''' 

53 module = cache_import_module( MODULE_QNAME ) 

54 module.install( None ) 

55 import builtins 

56 assert not hasattr( builtins, 'one' ) 

57 

58 

59def test_900_docstring_sanity( ): 

60 ''' Function has valid docstring. ''' 

61 module = cache_import_module( MODULE_QNAME ) 

62 assert hasattr( module.install, '__doc__' ) 

63 assert isinstance( module.install.__doc__, str ) 

64 assert module.install.__doc__