def test_get_cazy_data_no_fam_urls(cazy_home_url, cazy_dictionary, config_dict,
                                   time_stamp, null_logger,
                                   get_cazy_data_args_none, monkeypatch):
    """Test get_cazy_data."""
    with open(cazy_dictionary, "r") as fh:
        cazy_dict = json.load(fh)

    def mock_get_class_urls(*args, **kwargs):
        return [
            ["http://www.cazy.org/Glycoside-Hydrolases.html", 0],
            ["http://www.cazy.org/Polysaccharide-Lyases.html", 0],
        ]

    def mock_no_return(*args, **kwargs):
        return

    monkeypatch.setattr(cazy_webscraper, "get_class_urls", mock_get_class_urls)
    monkeypatch.setattr(crawler, "get_cazy_family_urls", mock_no_return)
    monkeypatch.setattr(parse, "proteins_to_dataframe", mock_no_return)
    monkeypatch.setattr(file_io, "write_out_failed_scrapes", mock_no_return)

    cazy_webscraper.get_cazy_data(
        cazy_home_url,
        None,
        config_dict,
        cazy_dict,
        1,
        time_stamp,
        null_logger,
        get_cazy_data_args_none["args"],
    )
def test_get_cazy_data_subfams_split_class(time_stamp, cazy_home_url,
                                           cazy_dictionary, config_dict,
                                           mock_family, null_logger,
                                           get_cazy_data_args_class,
                                           monkeypatch):
    """Test get_cazy_data() when data split is class and subfamily is True."""
    with open(cazy_dictionary, "r") as fh:
        cazy_dict = json.load(fh)

    def mock_get_class_urls(*args, **kwargs):
        return [
            ["http://www.cazy.org/Glycoside-Hydrolases.html", 0],
            ["http://www.cazy.org/Polysaccharide-Lyases.html", 0],
        ]

    def mock_get_family_urls(*args, **kwargs):
        return [
            "dddwww.cazddddy.org/GH1.html",
            "http://www.cazy.org/GH1.html",
            "http://www.cazy.org/PL1.html",
        ]

    def mock_parse_family(*args, **kwargs):
        return [mock_family, None]

    def mock_no_return(*args, **kwargs):
        return

    monkeypatch.setattr(cazy_webscraper, "get_class_urls", mock_get_class_urls)
    monkeypatch.setattr(crawler, "get_cazy_family_urls", mock_get_family_urls)
    monkeypatch.setattr(crawler, "parse_family", mock_parse_family)
    monkeypatch.setattr(parse, "proteins_to_dataframe", mock_no_return)
    monkeypatch.setattr(file_io, "write_out_failed_scrapes", mock_no_return)

    cazy_webscraper.get_cazy_data(
        cazy_home_url,
        None,
        config_dict,
        cazy_dict,
        1,
        time_stamp,
        null_logger,
        get_cazy_data_args_class["args"],
    )