コード例 #1
0
ファイル: tests.py プロジェクト: garym/ArangoPy
    def test_document_access_values_by_attribute_getter(self):
        doc = Document(id='', key='', collection='', api=client.api)
        # set this to true so it won't make requests to nothing
        doc.is_loaded = True
        doc_attr_value = 'foo_bar'
        doc.set(key='test', value=doc_attr_value)

        self.assertEqual(doc.test, doc_attr_value)
コード例 #2
0
    def test_document_access_values_by_attribute_getter(self):
        doc = Document(id='', key='', collection='', api=client.api)
        # set this to true so it won't make requests to nothing
        doc.is_loaded = True
        doc_attr_value = 'foo_bar'
        doc.set(key='test', value=doc_attr_value)

        self.assertEqual(doc.test, doc_attr_value)
コード例 #3
0
ファイル: document.py プロジェクト: garym/ArangoPy
def create_document_from_result_dict(result_dict, api):
    collection_name = result_dict['_id'].split('/')[0]

    doc = Document(
        id=result_dict['_id'],
        key=result_dict['_key'],
        collection=collection_name,
        api=api,
    )

    doc.is_loaded = True

    del result_dict['_id']
    del result_dict['_key']
    del result_dict['_rev']

    for result_key in result_dict:
        result_value = result_dict[result_key]

        doc.set(key=result_key, value=result_value)

    return doc