コード例 #1
0
    def test_follow_args_are_not_modified(self):

        parent = WithMethodWithExtraArgumentParent()
        child = WithMethodWithExtraArgumentChild()
        parent.child = child

        self.session.add(parent)
        self.session.add(child)
        self.session.commit()

        args = {
            'follow': {
                'child': {
                    'parent': 'some_parent',
                },
            },
        }

        orig_args = {
            'follow': {
                'child': {
                    'parent': 'some_parent',
                },
            },
        }

        parent.asdict(**args)

        assert args == orig_args
コード例 #2
0
    def test_extra_kwargs(self):

        parent = WithMethodWithExtraArgumentParent()
        child = WithMethodWithExtraArgumentChild()
        parent.child = child

        self.session.add(parent)
        self.session.add(child)
        self.session.commit()

        assert parent.asdict(follow=['child'],
                            method='extra_method',
                            number=123) == {
                                'id': parent.id,
                                'child_id': child.id,
                                'child': {
                                    'number': 123,
                                },
                            }