Project gets hashable obj from cli an returns uniqe items amount, other funcs desribed in README.md
Project description
Hello there! Since you installed my module, you shoud know possibilities
#First unique_char_counter_cli.py:
By imorting unique_char_counter_cli.py from unique_char_counter_cli_kir_boh, you will be able to use four functions:
return_amount_once_occured_items - gets hashable obj, cache it, count unique items deespite indentations.
get_obj_from_cli - The get_obj_from_cli function takes no arguments and returns a namespace object generated from
parsing command line arguments using the argparse module. It expects the user to pass either a string or a file
containing a hashable object. The function uses mutually exclusive arguments, so the user can only pass either the
string or the file, but not both. The hashable object is the only mandatory argument, which is obtained from the
command line.
read_file_in_chunks - reed file in chanks not to take a lot memory, gets two atrib 'path_to_file' (hasahable_obj) and
chunck_size (by defoult chunck_size=1000)
main - gets args from 'get_obj_from_cli', wich should be either file or string and hashable obj, then if it's fille,
it will execute 'read_file_in_chunks' then 'return_amount_once_occured_items' to return and print result
Hint: To use main from venv: python -m env_name\lib\site-packages\unique_char_counter_cli_kir_boh\unique_char_counter_cli.py -s 'f'
If you did't use venv: python -m path\shown\after\innstaling\unique_char_counter_cli_kir_boh\unique_char_counter_cli.py -s 'f'
#tests package:
By imorting tests_unique_char_counter_cli.py from unique_char_counter_cli_kir_boh.tests you get the pyton file with
TestUniqueCharCounterCli class wich inheritate from unittest.TestCase. After imporing, it is used as parent class
The test_return_amount_once_occured_items_with_string, test_return_amount_once_occured_items_with_empty_string,
test_return_amount_once_occured_items_with_space, and test_return_amount_once_occured_items_with_unhashable_obj
methods test the return_amount_once_occured_items function with different inputs.
The `test_main_with_mock_file` methods test the `main` function with different inputs using the `mock_open` and
`mock_get_obj_from_cli` decorators.
The `test_read_file_in_chunks` method tests the `read_file_in_chunks` function with a file input.
Hint: To use unittests from venv: python -m env_name\lib\site-packages\unique_char_counter_cli_kir_boh\tests\test_unique_char_counter_cli.py
If you did't use venv: python -m path\shown\after\innstaling\unique_char_counter_cli_kir_boh\tests\test_unique_char_counter_cli.py
To use with coverage: coverage run -m unittest discover -s path\shown\after\innstaling\unique_char_counter_cli_kir_boh\tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for unique_char_counter_cli_kir_boh-2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3859a067f120aa0c22bf8f0f1299fee74f5256439288abeb117853ec545b878c |
|
MD5 | e8e0c91e7d137608741d190d252c480a |
|
BLAKE2b-256 | 65ef52af8d501e0c16b86d7d099e1ece08237279863465f715077a303b7b7208 |
Close
Hashes for unique_char_counter_cli_kir_boh-2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 636c8c135ec286edb82844bdc3b17ccc1683c1935fb25e81e47a6673b290fa6e |
|
MD5 | 31a12d46146eba79747e439232da38c5 |
|
BLAKE2b-256 | bd3d43d5b11458dae2204eea22622741ca293c5fde0cef295fd7829bfcf738d2 |