コード例 #1
0
    def it_serializes_a_collection_correctly(self):
        """Dump the collection in this weird json format."""
        instances = Instances()
        instances.add(Instance({'id': 1}))

        eq_(json.dumps(self.expected_collection),
                JsonSerializer.dump(instances))
コード例 #2
0
    def it_populates_a_document_from_a_serialized_string(self):
        """Load a populated document from a json string."""
        obj = App()

        app = JsonSerializer.load(obj, json.dumps(self.fixture))

        eq_(self.fixture, app.render())
        eq_(app, obj)
コード例 #3
0
    def it_serializes_a_document_correctly(self):
        """Dump the document in this weird json format."""
        app = App(self.fixture)

        eq_(self.expected, json.loads(JsonSerializer.dump(app)))