def test_input_type(): '''test input type errors''' testfile = 'docs/trafilatura-demo.gif' testargs = ['', '-u', 'http'] with patch.object(sys, 'argv', testargs): assert cli.main() is None testargs = ['', '-v'] with patch.object(sys, 'argv', testargs): args = cli.parse_args(testargs) with open(testfile, 'rb') as f: teststring = f.read(1024) assert cli.examine(teststring, args) is None testfile = 'docs/usage.rst' with open(testfile, 'r') as f: teststring = f.read() assert cli.examine(teststring, args) is None # test file list assert 10 <= len(list(cli_utils.generate_filelist(RESOURCES_DIR))) <= 20
def test_input_type(): '''test input type errors''' testfile = 'docs/trafilatura-demo.gif' testargs = ['', '-u', 'http'] with patch.object(sys, 'argv', testargs): assert cli.main() is None testargs = ['', '-v'] with patch.object(sys, 'argv', testargs): args = cli.parse_args(testargs) with open(testfile, 'rb') as f: teststring = f.read(1024) assert cli.examine(teststring, args) is None testfile = 'docs/index.rst' with open(testfile, 'r') as f: teststring = f.read() assert cli.examine(teststring, args) is None # test file list assert cli_utils.generate_filelist(os.path.join(TEST_DIR, 'resources')) is not None
def test_cli_behavior(): '''Test command-line interface with respect to feeds''' testargs = ['', '--list', '--feed', 'https://httpbin.org/xml'] with patch.object(sys, 'argv', testargs): assert cli.main() is None