Improved code quality.

This commit is contained in:
Fabio Caccamo 2019-05-30 13:16:59 +02:00
parent 6afef2cd43
commit 408ebc3236
4 changed files with 13 additions and 13 deletions

View File

@ -8,21 +8,21 @@
[![License](https://img.shields.io/pypi/l/python-benedict.svg)](https://img.shields.io/pypi/l/python-benedict.svg) [![License](https://img.shields.io/pypi/l/python-benedict.svg)](https://img.shields.io/pypi/l/python-benedict.svg)
# python-benedict # python-benedict
python-benedict is the Python dictionary for humans dealing with evil data. python-benedict is the Python dictionary for humans dealing with evil/complex data.
## Features ## Features
- Full **keypath** support *(using the dot syntax)* - Full **keypath** support *(using the dot syntax)*
- Many **utility methods** to retrieve data as needed *(all methods listed below)* - Many **utility methods** to retrieve data as needed *(all methods listed below)*
- 100% **backward-compatible** *(you can replace existing dicts without pain)* - 100% **backward-compatible** *(you can replace existing dicts without pain)*
## Requirements ## Requirements
- Python 3.4, 3.5, 3.6, 3.7 - Python 3.4, 3.5, 3.6, 3.7
## Installation ## Installation
- Run `pip install python-benedict` - Run `pip install python-benedict`
## Testing ## Testing
- Run `tox` / `python setup.py test` - Run `tox` / `python setup.py test`
## Usage ## Usage
`benedict` is a dict subclass, so it is possible to use it as a normal dict *(you can just cast an existing dict)*. `benedict` is a dict subclass, so it is possible to use it as a normal dict *(you can just cast an existing dict)*.

View File

@ -5,7 +5,7 @@ python-benedict
=============== ===============
python-benedict is the Python dictionary for humans dealing with python-benedict is the Python dictionary for humans dealing with
evil data. evil/complex data.
Features Features
-------- --------

View File

@ -2,7 +2,7 @@
__author__ = 'Fabio Caccamo' __author__ = 'Fabio Caccamo'
__copyright__ = 'Copyright (c) 2019 Fabio Caccamo' __copyright__ = 'Copyright (c) 2019 Fabio Caccamo'
__description__ = 'python-benedict is the Python dictionary for humans dealing with evil data.' __description__ = 'python-benedict is the Python dictionary for humans dealing with evil/complex data.'
__license__ = 'MIT' __license__ = 'MIT'
__title__ = 'benedict' __title__ = 'benedict'
__version__ = '0.2.0' __version__ = '0.2.0'

View File

@ -140,7 +140,7 @@ class BenedictKeypathDictTestCase(unittest.TestCase):
} }
b = benedict(d) b = benedict(d)
with self.assertRaises(KeyError): with self.assertRaises(KeyError):
val = b['b'] b['b']
def test_getitem_with_1_not_str_key(self): def test_getitem_with_1_not_str_key(self):
d = { d = {
@ -152,7 +152,7 @@ class BenedictKeypathDictTestCase(unittest.TestCase):
self.assertEqual(b[None], None) self.assertEqual(b[None], None)
self.assertEqual(b[False], False) self.assertEqual(b[False], False)
with self.assertRaises(KeyError): with self.assertRaises(KeyError):
val = b[True] b[True]
self.assertEqual(b[0], 0) self.assertEqual(b[0], 0)
def test_get_with_2_valid_keys(self): def test_get_with_2_valid_keys(self):
@ -190,7 +190,7 @@ class BenedictKeypathDictTestCase(unittest.TestCase):
} }
b = benedict(d) b = benedict(d)
with self.assertRaises(KeyError): with self.assertRaises(KeyError):
val = b['b.a'] b['b.a']
def test_get_with_3_valid_keys(self): def test_get_with_3_valid_keys(self):
d = { d = {
@ -235,7 +235,7 @@ class BenedictKeypathDictTestCase(unittest.TestCase):
} }
b = benedict(d) b = benedict(d)
with self.assertRaises(KeyError): with self.assertRaises(KeyError):
val = b['c.b.a'] b['c.b.a']
def test_has_with_1_key(self): def test_has_with_1_key(self):
d = { d = {