Skip to content

first pass for AP-616#4

Open
jason-raitz wants to merge 6 commits intomainfrom
AP-616_add_search-to-file_method
Open

first pass for AP-616#4
jason-raitz wants to merge 6 commits intomainfrom
AP-616_add_search-to-file_method

Conversation

@jason-raitz
Copy link
Contributor

  • removed unused client.search()
  • added client.write_search_results_to_file()
  • added method to iterate through search xml results
  • added some xml fixtures for a first and last result for a sample search as well as the expected output xml for said search.

 - removed unused client.search()
 - added client.write_search_results_to_file()
 - added method to iterate through search xml results
 - added some xml fixtures for a first and last result for a sample
   search as well as the expected output xml for said search.
@jason-raitz jason-raitz self-assigned this Mar 18, 2026
 - commenting out for now to use as template for new tests
@awilfox
Copy link
Member

awilfox commented Mar 18, 2026

Since the eventual goal was to migrate Willa to this as well, I don't think search should be removed.

Copy link
Member

@anarchivist anarchivist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally looks good. what else is left other than the tests?

 - and some sensible guard statements
 - checked for some edge cases
 - lengthened max-line-length defaults to be a little friendlier
@jason-raitz jason-raitz marked this pull request as ready for review March 23, 2026 20:56
@jason-raitz
Copy link
Contributor Author

Questions

  • Do we want a standard max-line-length for python?
  • Do we want to formalize which python tools to use across our various python projects?
    (pylint, flake8, mypy, pydoc, uv, linting standards)
  • For client.write_search_results_to_file(), do we want to return '0' or an error when a Tind response is
    successful, but has no matches? Currently it writes nothing to a file and returns '0'.

Copy link
Member

@awilfox awilfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking really good, but we should find answers to your questions before merging IMO.

@awilfox
Copy link
Member

awilfox commented Mar 23, 2026

Questions

  • Do we want a standard max-line-length for python?

There's a lot of debate in the Python community over this. PEP 8 says 79 characters. I don't think modern Python can be effectively written with a 79 character limit. PyCharm and the Google style guide use 120. I think this is too long, and indeed, with my present eyesight my font size is too large to allow 120 characters to fit on the laptop screen. I think 100 is a fair compromise and is what we used in Willa.

  • Do we want to formalize which python tools to use across our various python projects?
    (pylint, flake8, mypy, pydoc, uv, linting standards)

This would be a great discussion to have at sprint planning.

  • For client.write_search_results_to_file(), do we want to return '0' or an error when a Tind response is
    successful, but has no matches? Currently it writes nothing to a file and returns '0'.

I'm firmly on the side of 0 results not being an error or an exceptional condition.

Comment on lines +194 to +200
def test_write_search_results_to_file_with_malformed_output_filename(
client: TINDClient,
malformed_filename: str = " .csv",
) -> None:
"""write_search_results_to_file raises ValueError for a malformed output filename."""
with pytest.raises(ValueError, match="output_file_name"):
client.write_search_results_to_file("", output_file_name = malformed_filename)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are we determining a malformed filename? i don't remember this being defined in the ticket.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not. just an edge case I threw in as a possibility. I could see a case where someone accidentally tries to give csv extension for the xml file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still take this out - it feels superfluous, and I can't think of a good reason why the client should care what the filename is that it's writing to.

jason-raitz and others added 2 commits March 24, 2026 11:31
Co-authored-by: Anna Wilcox <AWilcox@Wilcox-Tech.com>
 - reverts max-line-length preference to 100
 - fixes some tests
 - clarifies a couple of edge cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants