Skip to content

Commit

Permalink
code coverage added. Some typos fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
dapper91 committed Aug 25, 2019
1 parent f0db2f3 commit 34742cf
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 28 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ install:
- pip install pipenv --upgrade
- pipenv install --dev
script:
- pipenv run py.test
- pipenv run py.test --cov=paxb tests
after_success:
- codecov
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

0.2.1 (2019-08-26)
------------------
- code coverage added.


0.2.0 (2019-08-25)
------------------

Expand Down
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ name = "pypi"
attrs = "~=19.0"

[dev-packages]
codecov = "~=2.0"
pre-commit = "~=1.0"
pytest = "~=4.0"
pytest-cov = "~=2.7"
xmldiff = "~=2.0"

[requires]
Expand Down
19 changes: 11 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ paxb
.. image:: https://img.shields.io/pypi/pyversions/paxb.svg
:target: https://pypi.org/project/paxb
:alt: Supported Python versions
.. image:: https://codecov.io/gh/dapper91/paxb/branch/master/graph/badge.svg
:target: https://codecov.io/gh/dapper91/paxb
:alt: Code coverage


Python Architecture for XML Binding
Expand All @@ -28,7 +31,7 @@ paxb library implements the following functionality:
paxb provides an efficient way of mapping between an XML document and a Python object. Using paxb
developers can write less boilerplate code emphasizing on application business logic.

As soon as paxb based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library paxb and attrs
Since paxb based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library paxb and attrs
API can be mixed together.


Expand Down Expand Up @@ -121,19 +124,19 @@ need to describe field mappings and types, paxb will serialize and deserialize d
surname = pb.attr()
age = pb.attr(converter=int)
_birth_year = pb.wrap('birthdate', pb.attr('year', converter=int))
_birth_month = pb.wrap('birthdate', pb.attr('month', converter=int))
_birth_day = pb.wrap('birthdate', pb.attr('day', converter=int))
birth_year = pb.wrap('birthdate', pb.attr('year', converter=int))
birth_month = pb.wrap('birthdate', pb.attr('month', converter=int))
birth_day = pb.wrap('birthdate', pb.attr('day', converter=int))
@property
def birthdate(self):
return date(year=self._birth_year, month=self._birth_month, day=self._birth_day)
return date(year=self.birth_year, month=self.birth_month, day=self.birth_day)
@birthdate.setter
def birthdate(self, value):
self._birth_year = value.year
self._birth_month = value.month
self._birth_day = value.day
self.birth_year = value.year
self.birth_month = value.month
self.birth_day = value.day
phone = pb.wrap('contacts', pb.field())
emails = pb.wrap('contacts', pb.as_list(pb.field(name='email')))
Expand Down
5 changes: 4 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ paxb: Python Architecture for XML Binding
.. image:: https://img.shields.io/pypi/pyversions/paxb.svg
:target: https://pypi.org/project/paxb
:alt: Supported Python versions
.. image:: https://codecov.io/gh/dapper91/paxb/branch/master/graph/badge.svg
:target: https://codecov.io/gh/dapper91/paxb
:alt: Code coverage


``paxb`` is a library that provides an API for mapping between XML documents and Python objects.
Expand All @@ -29,7 +32,7 @@ paxb: Python Architecture for XML Binding
``paxb`` provides an efficient way of mapping between an XML document and a Python object. Using paxb
developers can write less boilerplate code emphasizing on application domain logic.

As soon as paxb is based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library ``paxb`` and attrs
Since paxb is based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library ``paxb`` and attrs
API can be :doc:`mixed <paxb/attrs>` together.


Expand Down
2 changes: 1 addition & 1 deletion docs/paxb/attrs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
attrs library integration
=========================

As soon as ``paxb`` is based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library paxb and attrs
Since ``paxb`` is based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library paxb and attrs
APIs can be mixed together.


Expand Down
15 changes: 8 additions & 7 deletions docs/paxb/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,19 @@ Instead you can use ``paxb`` api to write declarative style code. All you need t
surname = pb.attr()
age = pb.attr(converter=int)
_birth_year = pb.wrap('birthdate', pb.attr('year', converter=int))
_birth_month = pb.wrap('birthdate', pb.attr('month', converter=int))
_birth_day = pb.wrap('birthdate', pb.attr('day', converter=int))
birth_year = pb.wrap('birthdate', pb.attr('year', converter=int))
birth_month = pb.wrap('birthdate', pb.attr('month', converter=int))
birth_day = pb.wrap('birthdate', pb.attr('day', converter=int))
@property
def birthdate(self):
return date(year=self._birth_year, month=self._birth_month, day=self._birth_day)
return date(year=self.birth_year, month=self.birth_month, day=self.birth_day)
@birthdate.setter
def birthdate(self, value):
self._birth_year = value.year
self._birth_month = value.month
self._birth_day = value.day
self.birth_year = value.year
self.birth_month = value.month
self.birth_day = value.day
phone = pb.wrap('contacts', pb.field())
emails = pb.wrap('contacts', pb.as_list(pb.field(name='email')))
Expand Down Expand Up @@ -120,6 +120,7 @@ Then the deserialized object can be modified and serialized back to xml document
``user.json``:


.. code-block:: json
{
Expand Down
2 changes: 1 addition & 1 deletion docs/paxb/serialization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The default behaviour can be altered using ``encoder`` argument. Encoder must be
an encoded value and returns its :py:class:`str` representation.


As soon as ``paxb`` is based on :py:mod:`attr` library, :py:func:`attr.asdict` function can
Since ``paxb`` is based on :py:mod:`attr` library, :py:func:`attr.asdict` function can
be used to serialize an object to a json string:

.. doctest::
Expand Down
14 changes: 7 additions & 7 deletions examples/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ class User:
surname = pb.attr()
age = pb.attr(converter=int)

_birth_year = pb.wrap('birthdate', pb.attr('year', converter=int))
_birth_month = pb.wrap('birthdate', pb.attr('month', converter=int))
_birth_day = pb.wrap('birthdate', pb.attr('day', converter=int))
birth_year = pb.wrap('birthdate', pb.attr('year', converter=int))
birth_month = pb.wrap('birthdate', pb.attr('month', converter=int))
birth_day = pb.wrap('birthdate', pb.attr('day', converter=int))

@property
def birthdate(self):
return date(year=self._birth_year, month=self._birth_month, day=self._birth_day)
return date(year=self.birth_year, month=self.birth_month, day=self.birth_day)

@birthdate.setter
def birthdate(self, value):
self._birth_year = value.year
self._birth_month = value.month
self._birth_day = value.day
self.birth_year = value.year
self.birth_month = value.month
self.birth_day = value.day

phone = pb.wrap('contacts', pb.field())
emails = pb.wrap('contacts', pb.as_list(pb.field(name='email')))
Expand Down
2 changes: 1 addition & 1 deletion paxb/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__description__ = 'Python Architecture for XML Binding'
__url__ = 'https://github.com/dapper91/paxb'

__version__ = '0.2.0'
__version__ = '0.2.1'

__author__ = 'Dmitry Pershin'
__email__ = 'dapper91@mail.ru'
Expand Down
2 changes: 1 addition & 1 deletion paxb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
paxb provides an efficient way of mapping between an XML document and a Python object. Using paxb
developers can write less boilerplate code emphasizing on application business logic.
As soon as paxb based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library paxb and attrs
Since paxb based on `attrs <https://www.attrs.org/en/stable/index.html>`_ library paxb and attrs
API can be mixed together.
"""

Expand Down

0 comments on commit 34742cf

Please sign in to comment.