-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.1.4 - Added
env_bool
function, csv/kval functions now allow sepa…
…rator to be overriden. **New functions / code improvements** - Added `env_bool` function to `common.py` for loading an environment var as a boolean - Added `csvsplit` parameter to parse/env_csv and keyval, to allow changing the item separator from `,` - Added `valsplit` parameter to parse/env_keyval, to allow customising the separator between key's and value's from `:` **Documentation** - Added PyDoc param's / return's for various functions, and fleshed out some others - Wrapped various docstring values such as ``True`` and ``0`` with backticks so they display better - Various small formatting improvements to existing docstrings - Added `PrivexBaseCase` and `env_bool` to the docs **Unit Testing** - Refactored various attributes in `test.py` into the base class `PrivexBaseClass` - Added example to the PyDoc in `tests.py` showing how to run tests with `pytest` - Wrote new unit tests: - `test_kval_custom_clean` - Validates that `parse_keyval` works properly with custom `valsplit`/`csvsplit` - `test_kval_custom_spaced` - Validates that `parse_keyval` works properly with space padded values and custom `valsplit`/`csvsplit` - `test_env_nonexist_bool`, `test_env_bool_true`, `test_env_bool_false` - Validate that the new `env_bool` function returns the correct values.
- Loading branch information
1 parent
aa75feb
commit 19a0164
Showing
7 changed files
with
273 additions
and
47 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
docs/source/helpers/common/privex.helpers.common.env_bool.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
privex.helpers.common.env\_bool | ||
=============================== | ||
|
||
.. currentmodule:: privex.helpers.common | ||
|
||
.. autofunction:: env_bool |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ privex.helpers.common | |
empty | ||
env_csv | ||
env_keyval | ||
env_bool | ||
is_false | ||
is_true | ||
parse_csv | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
tests.PrivexBaseCase | ||
==================== | ||
|
||
.. currentmodule:: tests | ||
|
||
.. autoclass:: PrivexBaseCase | ||
|
||
|
||
.. automethod:: __init__ | ||
|
||
|
||
.. rubric:: Methods | ||
|
||
.. autosummary:: | ||
|
||
~PrivexBaseCase.__init__ | ||
~PrivexBaseCase.addCleanup | ||
~PrivexBaseCase.addTypeEqualityFunc | ||
~PrivexBaseCase.assertAlmostEqual | ||
~PrivexBaseCase.assertAlmostEquals | ||
~PrivexBaseCase.assertCountEqual | ||
~PrivexBaseCase.assertDictContainsSubset | ||
~PrivexBaseCase.assertDictEqual | ||
~PrivexBaseCase.assertEqual | ||
~PrivexBaseCase.assertEquals | ||
~PrivexBaseCase.assertFalse | ||
~PrivexBaseCase.assertGreater | ||
~PrivexBaseCase.assertGreaterEqual | ||
~PrivexBaseCase.assertIn | ||
~PrivexBaseCase.assertIs | ||
~PrivexBaseCase.assertIsInstance | ||
~PrivexBaseCase.assertIsNone | ||
~PrivexBaseCase.assertIsNot | ||
~PrivexBaseCase.assertIsNotNone | ||
~PrivexBaseCase.assertLess | ||
~PrivexBaseCase.assertLessEqual | ||
~PrivexBaseCase.assertListEqual | ||
~PrivexBaseCase.assertLogs | ||
~PrivexBaseCase.assertMultiLineEqual | ||
~PrivexBaseCase.assertNotAlmostEqual | ||
~PrivexBaseCase.assertNotAlmostEquals | ||
~PrivexBaseCase.assertNotEqual | ||
~PrivexBaseCase.assertNotEquals | ||
~PrivexBaseCase.assertNotIn | ||
~PrivexBaseCase.assertNotIsInstance | ||
~PrivexBaseCase.assertNotRegex | ||
~PrivexBaseCase.assertNotRegexpMatches | ||
~PrivexBaseCase.assertRaises | ||
~PrivexBaseCase.assertRaisesRegex | ||
~PrivexBaseCase.assertRaisesRegexp | ||
~PrivexBaseCase.assertRegex | ||
~PrivexBaseCase.assertRegexpMatches | ||
~PrivexBaseCase.assertSequenceEqual | ||
~PrivexBaseCase.assertSetEqual | ||
~PrivexBaseCase.assertTrue | ||
~PrivexBaseCase.assertTupleEqual | ||
~PrivexBaseCase.assertWarns | ||
~PrivexBaseCase.assertWarnsRegex | ||
~PrivexBaseCase.assert_ | ||
~PrivexBaseCase.countTestCases | ||
~PrivexBaseCase.debug | ||
~PrivexBaseCase.defaultTestResult | ||
~PrivexBaseCase.doCleanups | ||
~PrivexBaseCase.fail | ||
~PrivexBaseCase.failIf | ||
~PrivexBaseCase.failIfAlmostEqual | ||
~PrivexBaseCase.failIfEqual | ||
~PrivexBaseCase.failUnless | ||
~PrivexBaseCase.failUnlessAlmostEqual | ||
~PrivexBaseCase.failUnlessEqual | ||
~PrivexBaseCase.failUnlessRaises | ||
~PrivexBaseCase.id | ||
~PrivexBaseCase.run | ||
~PrivexBaseCase.setUp | ||
~PrivexBaseCase.setUpClass | ||
~PrivexBaseCase.shortDescription | ||
~PrivexBaseCase.skipTest | ||
~PrivexBaseCase.subTest | ||
~PrivexBaseCase.tearDown | ||
~PrivexBaseCase.tearDownClass | ||
|
||
|
||
|
||
|
||
|
||
.. rubric:: Attributes | ||
|
||
.. autosummary:: | ||
|
||
~PrivexBaseCase.empty_lst | ||
~PrivexBaseCase.empty_vals | ||
~PrivexBaseCase.empty_zero | ||
~PrivexBaseCase.falsey | ||
~PrivexBaseCase.falsey_empty | ||
~PrivexBaseCase.longMessage | ||
~PrivexBaseCase.maxDiff | ||
~PrivexBaseCase.truthy | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ tests | |
TestBoolHelpers | ||
TestIPReverseDNS | ||
TestParseHelpers | ||
PrivexBaseCase | ||
|
||
|
||
|
||
|
This file contains 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
This file contains 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
Oops, something went wrong.