How to use the typedload.attrdump function in typedload

To help you get started, we’ve selected a few typedload examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ltworf / typedload / tests / test_attrload.py View on Github external
def test_dump_metanames(self):
        assert attrdump(Mangle(12)) == {'va.lue': 12}
github ltworf / typedload / tests / test_attrload.py View on Github external
def test_basicdump(self):
        assert attrdump(Person()) == {}
        assert attrdump(Person('Alfio')) == {'name': 'Alfio'}
        assert attrdump(Person('Alfio', '33')) == {'name': 'Alfio', 'address': '33'}
github ltworf / typedload / tests / test_attrload.py View on Github external
def test_nesteddump(self):
        assert attrdump(
            Students('advanced coursing', [
            Person('Alfio'),
            Person('Carmelo', 'via mulino'),
        ])) == {
            'course': 'advanced coursing',
            'students': [
                {'name': 'Alfio'},
                {'name': 'Carmelo', 'address': 'via mulino'},
            ]
github ltworf / typedload / tests / test_attrload.py View on Github external
def test_norepr(self):
        @attr.s
        class A:
            i = attr.ib(type=int)
            j = attr.ib(type=int, repr=False)
        assert attrdump(A(1,1)) == {'i': 1}