Ejemplo n.º 1
0
    def test_duplicates_get_removed(self):
        c = Collector()
        c.include('people', 1, {'id': 1})
        c.include('people', 1, {'id': 1})
        c.include('people', 2, {'id': 2})

        assert c.get_included_resources() == {
            'people': [
                {
                    'id': 1
                },
                {
                    'id': 2
                },
            ],
        }
Ejemplo n.º 2
0
    def test_included_items_get_sorted(self):
        c = Collector()
        c.include('people', 1, {'id': 1})
        c.include('people', 3, {'id': 3})
        c.include('people', 2, {'id': 2})

        assert c.get_included_resources() == {
            'people': [
                {
                    'id': 1
                },
                {
                    'id': 2
                },
                {
                    'id': 3
                },
            ],
        }