Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
'platform': 'linux',
'repo_directory': '/tmp/tldr'
}
expected_result = (
'\n'
'\x1b[0m\x1b[34m Main node command\n'
'\x1b[0m\n\x1b[0m\x1b[32m- Call an interactive node shell'
'\n\x1b[0m\n\x1b[0m\x1b[36m node\n'
'\x1b[0m\n\x1b[0m\x1b[32m- Execute node on a JS file\n'
'\x1b[0m\n\x1b[0m\x1b[36m node {{FILENAME}}.js\n'
'\x1b[0m\n\x1b[0m'
)
with mock.patch('tldr.parser.get_config', return_value=mock_config):
with mock.patch('io.open', mock.mock_open(read_data=page_content)):
result = parse_page('/repo_directory/pages/common/node.md')
assert ''.join(result) == expected_result
def parse_man_page(command, platform):
"""Parse the man page and return the parsed lines."""
page_path = find_page_location(command, platform)
output_lines = parse_page(page_path)
return output_lines