Skip to content

Commit

Permalink
python/word-count: 4th iteration - new project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Jan 17, 2024
1 parent 3f55cc5 commit a367167
Show file tree
Hide file tree
Showing 19 changed files with 213 additions and 199 deletions.
1 change: 0 additions & 1 deletion python/word-count

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" ?>
<coverage version="7.2.3" timestamp="1687762285141" lines-valid="16" lines-covered="16" line-rate="1" branches-valid="6" branches-covered="6" branch-rate="1" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.2.3 -->
<coverage version="7.4.0" timestamp="1705470693167" lines-valid="16" lines-covered="16" line-rate="1" branches-valid="6" branches-covered="6" branch-rate="1" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.4.0 -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
<source>/home/vpayno/git_vpayno/exercism-workspace/python/wordcount</source>
<source>/home/vpayno/git_vpayno/exercism-workspace/python/word-count</source>
</sources>
<packages>
<package name="." line-rate="1" branch-rate="1" complexity="0">
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions python/word-count/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
pythonpath = .
addopts = --doctest-modules
markers =
task: exercise task/step
203 changes: 203 additions & 0 deletions python/word-count/run-tests-python.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
Running automated test file(s):


===============================================================================

Running: pylint ./src

-------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 9.63/10, +0.37)


real 0m0.954s
user 0m0.865s
sys 0m0.091s

===============================================================================

Running: ruff check --ignore E501 ./src

real 0m0.089s
user 0m0.033s
sys 0m0.060s

===============================================================================

Running: pyright --stats ./src
Found 2 source files
pyright 1.1.347
0 errors, 0 warnings, 0 informations
Completed in 0.611sec

Analysis stats
Total files parsed and bound: 22
Total files checked: 2

Timing stats
Find Source Files: 0sec
Read Source Files: 0sec
Tokenize: 0.04sec
Parse: 0.04sec
Resolve Imports: 0.06sec
Bind: 0.07sec
Check: 0.08sec
Detect Cycles: 0sec

real 0m1.512s
user 0m1.258s
sys 0m0.181s

===============================================================================

Running: bandit --verbose --recursive ./src
[main] INFO profile include tests: None
[main] INFO profile exclude tests: None
[main] INFO cli include tests: None
[main] INFO cli exclude tests: None
[main] INFO running on Python 3.12.1
Run started:2024-01-17 05:51:31.087754
Files in scope (2):
./src/word_count/__init__.py (score: {SEVERITY: 0, CONFIDENCE: 0})
./src/word_count/word_count.py (score: {SEVERITY: 0, CONFIDENCE: 0})
Files excluded (0):

Test results:
No issues identified.

Code scanned:
Total lines of code: 21
Total lines skipped (#nosec): 0
Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
Total issues (by severity):
Undefined: 0
Low: 0
Medium: 0
High: 0
Total issues (by confidence):
Undefined: 0
Low: 0
Medium: 0
High: 0
Files skipped (0):

real 0m0.297s
user 0m0.235s
sys 0m0.064s

===============================================================================

Running: refurb ./src
src/word_count/word_count.py:21:5 [FURB184]: Assignment statement should be chained

Run `refurb --explain ERR` to further explain an error. Use `--quiet` to silence this message

real 0m1.176s
user 0m1.085s
sys 0m0.093s

===============================================================================

python -m doctest -v ./src/word_count/__init__.py ./src/word_count/word_count.py
1 items had no tests:
__init__
0 tests in 1 items.
0 passed and 0 failed.
Test passed.
2 items had no tests:
word_count
word_count.count_words
0 tests in 2 items.
0 passed and 0 failed.
Test passed.

real 0m0.111s
user 0m0.056s
sys 0m0.055s


===============================================================================

==> .coveragerc <==
[run]
omit = __init__.py, *_test.py

Running: PYTHONPATH=./src pytest --verbose --cov=. --cov-branch --cov-report=term-missing --cov-report=xml:.coverage.xml -p no:randomly ./test
============================= test session starts ==============================
platform linux -- Python 3.12.1, pytest-7.4.3, pluggy-1.3.0 -- /home/vpayno/.pyenv/versions/3.12.1/bin/python
cachedir: .pytest_cache
rootdir: /home/vpayno/git_vpayno/exercism-workspace/python/word-count
configfile: pytest.ini
plugins: anyio-4.2.0, libtmux-0.25.0, pylama-8.4.1, cov-4.1.0, datafiles-3.0.0, docker-2.0.1, subprocess-1.5.0, typeguard-4.1.5
collecting ... collected 17 items

test/word_count_test.py::WordCountTest::test_alternating_word_separators_not_detected_as_a_word PASSED [ 5%]
test/word_count_test.py::WordCountTest::test_count_one_of_each_word PASSED [ 11%]
test/word_count_test.py::WordCountTest::test_count_one_word PASSED [ 17%]
test/word_count_test.py::WordCountTest::test_handles_cramped_lists PASSED [ 23%]
test/word_count_test.py::WordCountTest::test_handles_expanded_lists PASSED [ 29%]
test/word_count_test.py::WordCountTest::test_ignore_punctuation PASSED [ 35%]
test/word_count_test.py::WordCountTest::test_include_numbers PASSED [ 41%]
test/word_count_test.py::WordCountTest::test_multiple_apostrophes_ignored PASSED [ 47%]
test/word_count_test.py::WordCountTest::test_multiple_occurrences_of_a_word PASSED [ 52%]
test/word_count_test.py::WordCountTest::test_multiple_spaces_not_detected_as_a_word PASSED [ 58%]
test/word_count_test.py::WordCountTest::test_non_alphanumeric PASSED [ 64%]
test/word_count_test.py::WordCountTest::test_normalize_case PASSED [ 70%]
test/word_count_test.py::WordCountTest::test_quotation_for_word_with_apostrophe PASSED [ 76%]
test/word_count_test.py::WordCountTest::test_substrings_from_the_beginning PASSED [ 82%]
test/word_count_test.py::WordCountTest::test_tabs PASSED [ 88%]
test/word_count_test.py::WordCountTest::test_with_apostrophes PASSED [ 94%]
test/word_count_test.py::WordCountTest::test_with_quotations PASSED [100%]

---------- coverage: platform linux, python 3.12.1-final-0 -----------
Name Stmts Miss Branch BrPart Cover Missing
-----------------------------------------------------------
word_count.py 16 0 6 0 100%
-----------------------------------------------------------
TOTAL 16 0 6 0 100%
Coverage XML written to file .coverage.xml


============================== 17 passed in 0.09s ==============================

real 0m0.863s
user 0m0.718s
sys 0m0.143s

===============================================================================

Running: coverage report --show-missing
Name Stmts Miss Branch BrPart Cover Missing
-----------------------------------------------------------
word_count.py 16 0 6 0 100%
-----------------------------------------------------------
TOTAL 16 0 6 0 100%

real 0m0.170s
user 0m0.111s
sys 0m0.061s

===============================================================================

coverage annotate

real 0m0.158s
user 0m0.106s
sys 0m0.054s

tail -n 10000 ./*,cover | grep -E -C 3 '^> def |^! '

> def count_words(sentence: str) -> Dict[str, int]:
> """Counts the number of times each word in a string is used.

===============================================================================

Running: misspell ./src/word_count/__init__.py ./src/word_count/word_count.py

real 0m0.020s
user 0m0.019s
sys 0m0.011s

===============================================================================

File renamed without changes.
1 change: 1 addition & 0 deletions python/word-count/src/word_count/word_count.py
Empty file.
1 change: 1 addition & 0 deletions python/word-count/test/word_count_test.py
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a367167

Please sign in to comment.