def test_section_is_in(): """Test Section is_in method.""" section_file = Section() section_file.read = utils.mock_read(SECTION_STR) assert section_file.is_in(FILE_HAS_SECTION_STR) assert section_file.is_in(FILE_WITH_SECTION_STR) assert not section_file.is_in(FILE_WITHOUT_SECTION_STR)
def test_section_is_in_bad_data(): """Test Section is_in method passing in bad data.""" section_file = Section() section_file.read = utils.mock_read(SECTION_STR) with pytest.raises(ValueError): assert section_file.is_in(FILE_BAD_SECTION_STR) with pytest.raises(ValueError): assert section_file.is_in(FILE_BAD_SECTION2_STR)