potc.testing.property

provement

potc.testing.property.provement(trans=None)[source]
Overview:

Create a test class containing the tests of the basic properties.

Arguments:
  • trans: Translator object to be used.

Examples:

>>> import pytest
>>> from potc_typing.plugin import __rules__  # load rules from plugin potc_typing
>>>
>>> from potc.testing import provement
>>> from potc.translate import BlankTranslator
>>>
>>>
>>> @pytest.mark.unittest
>>> class TestPlugin(provement(BlankTranslator(__rules__))):
...     def test_pretty_dict(self):
...         with self.transobj_assert({'a': 1}) as (obj, name):
...             assert obj == {'a': 1}
...             assert name == 'pretty_dict'
...         with self.transobj_assert({}) as (obj, name):
...             assert obj == {}
...             assert name == 'pretty_dict'
...         with self.transobj_assert({1: 2}) as (obj, name):
...             assert obj == {1: 2}
...             assert name == 'builtin_dict'
...
...         with self.transvars_assert({'a': {'b': 1}}) as (vars_, code):
...             assert vars_ == {'a': {'b': 1}}
...             assert 'dict(b=1)' in code