hugovk / em-keyboard

The CLI emoji keyboard
ISC License
310 stars 31 forks source link

Additional tests #127

Closed cofiem closed 1 year ago

cofiem commented 1 year ago

Test random with no copy. Test supplying no name.

codecov[bot] commented 1 year ago

Codecov Report

Merging #127 (0f8d1c3) into main (eabb46b) will increase coverage by 0.76%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #127      +/-   ##
==========================================
+ Coverage   97.64%   98.41%   +0.76%     
==========================================
  Files           2        2              
  Lines         170      189      +19     
==========================================
+ Hits          166      186      +20     
+ Misses          4        3       -1     
Flag Coverage Δ
macos-latest 94.17% <100.00%> (+1.82%) :arrow_up:
ubuntu-latest 93.65% <100.00%> (+1.29%) :arrow_up:
windows-latest 94.17% <100.00%> (+1.82%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
tests/test_em.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

cofiem commented 1 year ago

No worries.

While I'm here, I'm not sure I understand this line:

        sys.exit("Error: the 'name' argument is required")

Could that be this instead?

        print("Error: the 'name' argument is required", file=sys.stderr)
        sys.exit(1)
hugovk commented 1 year ago

They do more or less the same thing.

https://docs.python.org/3/library/sys.html#sys.exit says:

The optional argument arg can be an integer giving the exit status (defaulting to zero), or another type of object. If it is an integer, zero is considered “successful termination” and any nonzero value is considered “abnormal termination” by shells and the like. Most systems require it to be in the range 0–127, and produce undefined results otherwise. Some systems have a convention for assigning specific meanings to specific exit codes, but these are generally underdeveloped; Unix programs generally use 2 for command line syntax errors and 1 for all other kind of errors. If another type of object is passed, None is equivalent to passing zero, and any other object is printed to stderr and results in an exit code of 1. In particular, sys.exit("some error message") is a quick way to exit a program when an error occurs.

cofiem commented 1 year ago

Ah, I did not know that shortcut. Thanks!