Skip to content

Commit

Permalink
Merge pull request #25 from ducdetronquito/hotfix/0.4.2
Browse files Browse the repository at this point in the history
🐛🔖 Release 0.4.2
  • Loading branch information
ducdetronquito authored Apr 11, 2021
2 parents 6c0f25a + 3e218a8 commit a11a6a6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"

install:
- pip3 install -e .
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Scalpl
.. image:: https://img.shields.io/badge/coverage-100%25-green.svg
:target: #

.. image:: https://img.shields.io/badge/pypi-v0.4.1-blue.svg
.. image:: https://img.shields.io/badge/pypi-v0.4.2-blue.svg
:target: https://pypi.python.org/pypi/scalpl/

.. image:: https://travis-ci.org/ducdetronquito/scalpl.svg?branch=master
Expand Down
2 changes: 1 addition & 1 deletion scalpl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .scalpl import Cut

__version__ = "0.4.1"
__version__ = "0.4.2"
5 changes: 4 additions & 1 deletion scalpl/scalpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ class Cut:
__slots__ = ("data", "sep")

def __init__(self, data: Optional[dict] = None, sep: str = ".") -> None:
self.data = data or {}
if data is None:
self.data = {}
else:
self.data = data
self.sep = sep

def __bool__(self) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
setup(
name="scalpl",
packages=["scalpl"],
version="0.4.1",
version="0.4.2",
description=("A lightweight wrapper to operate on nested dictionaries seamlessly."),
long_description=readme,
author="Guillaume Paulet",
author_email="guillaume.paulet@giome.fr",
license="Public Domain",
url="https://github.com/ducdetronquito/scalpl",
download_url=("https://github.com/ducdetronquito/scalpl/archive/" "0.4.1.tar.gz"),
download_url=("https://github.com/ducdetronquito/scalpl/archive/" "0.4.2.tar.gz"),
tests_require=[
"addict",
"mypy",
Expand Down
11 changes: 11 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ def test_index_error(self):
assert str(error.value) == str(expected_error)


class TestInit:
def test_without_data(self):
proxy = Cut()
assert proxy.data == {}

def test_with_an_empty_dict(self, dict_type):
data = dict_type()
proxy = Cut(data)
assert proxy.data is data


@pytest.mark.parametrize("data,result", [({"a": 42}, True), ({}, False)])
def test_bool(dict_type, data, result):
proxy = Cut(dict_type(data))
Expand Down

0 comments on commit a11a6a6

Please sign in to comment.