Print collections of long strings over multiple lines
See original GitHub issueDiscussed in https://github.com/fluentassertions/fluentassertions/discussions/1722
<div type='discussions-op-text'>Originally posted by rcdailey October 27, 2021
When I have a BeEquivalentTo()
comparison between two lists of strings, the output looks like this:
Expected DynamicMenuTestHelpers.FixupCaptions(menu.ItemLinks) to be a collection with 4 item(s), but {"Generate Report (DR Objects)", "Generate Report (Non-DR Objects)"}"
"contains 2 item(s) less than"
"{"Schedule Disaster Recovery Backups...", "Run Backup Now", "Generate Report (DR Objects)", "Generate Report (Non-DR Objects)"}.
I personally find this difficult to read, mainly because everything is on one line. Is there a way to make this print out “prettier”? Something as simple as one string per line I think might make this more legible.</div>
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How do I split the definition of a long string over multiple ...
Long lines can be broken over multiple lines by wrapping expressions in parentheses. These should be used in preference to using a backslash...
Read more >Write a long string on multiple lines in Python - nkmk note
This article explains how to break a long string into multiple lines without including a newline character. Contents.
Read more >Write a Long String on Multiple Lines in Python
This method allows you to include line breaks and special characters like newline characters directly in the string without using escape ...
Read more >Python Multiline Strings
You can assign a multiline string to a variable by using three quotes: ... print(a). Try it Yourself ». Note: in the result,...
Read more >How Can I Define Multiline String In Python
The simplest way to do it is to enclose the entire string with three sets of double quotes: e.g.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Along the lines of making this more “Readable”, I thought of another idea:
Instead of saying:
Instead, just show what is missing:
This is shorter, easier to read, and a little less confusing. I personally am only interested in what is missing. I usually look at the unit test code anyway to see what was there. Maybe there’s a different set of valid use cases for both, so I’d also be happy with the “delta” version of this (the bottom example) being an opt-in feature.
So really I’d boil down this issue into two main parts:
Thank you for being so open minded about my suggestions! Love the library!!
@Constante-ou-Mort The FluentAssertions developers are likely not paid to do work here, nor do they work for you. Respectfully, if you want to see change, it would be far more productive to fork the repository and contribute code. If you aren’t willing to do that, the best you can do is thumbs up the issue and move on. Your comments are a distraction to the developers and to others subscribed to this issue to be notified of meaningful updates.
I apologize that my tone seems aggressive or rude; I only intend to be frank. I hope you understand. It’s hard for me to wait too, but that’s open source.
To the maintainers: My feelings wouldn’t be hurt if you decided to lock conversation on this issue to maintainers only.