-
Notifications
You must be signed in to change notification settings - Fork 0
Add invisible-ink-mono to ch06 #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # tests/test_chapter06.py
RIP coverage, including line 108, now there are a total of two uncovered lines in the entire project. impracticalpythonprojects/src/ch06/c1_invisible_ink_mono.py Lines 107 to 108 in f4a7aca
At least every experience can be a learning experience. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Finish off Chapter 6 with a monospace invisible ink writer challenge project.
Description
Uses a monospace font to embed a hidden message in the whitespace between letters. The biggest challenge was writing color tests for the spaces between words in
tests/test_chapter06.py
.It uses a similar logic to putting the cipher letters between words. That may be considered more of an integration test, but I opted to not put them in a separate file since there are so few of them.
Selecting a monospace font is another challenge. Unfortunately, different operating systems use different fonts. To mitigate this issue, the code uses
platform.system
to query the platform and attempt to select an appropriate font.Creating a blank default template in LibreOffice is another challenge. To change a style, it often has to be applied to a paragraph. In this case, LibreOffice applies the modified style to a blank paragraph. Normally, this wouldn't matter, but Microsoft Word doesn't need to apply a modified style to a paragraph in order to save it.
I wanted to create a function to do the font color tests, but this inconsistency prevents me from doing so because it always loads a blank as the first text object, but only from the monospace template file. I could just create a template in Word, but, to me, that defeats the purpose of using open software. For now, the font color tests are separate for the two different font types.
For many reasons, this code shouldn't be used for covert operations, but one of the main ones is that it creates giant run-on sentences that the spell checker is all too quick to point out. Nevertheless, it was a fun project to work on. For example,
src/ch06/c1files/fake.docx
is an open letter of sorts to the Internet briefly discussing its origins, reminiscing about its past, and speculating about its future. Part fun, part making enough test spaces.Normally, I'd reference #1 as a running gag about making PRs, but I've accepted these as a pseudo-blog and will, regrettably, stop referencing #1 after this PR. May the meme live on in our hearts.
Team Notifications
Me, myself, and I