Skip to main content

objectdict

Project description

使用方法

import json
from unittest import TestCase

from objectdict import ObjectDict


class TestObjectDict(TestCase):

    def test_value(self):
        class SimpleObjectDict(ObjectDict):
            int_field: int = 1
            str_field = 'a'
            dict_field = {}
            int2_f: int
            _protect = 'protect'

            @classmethod
            def classmethod(cls):
                pass

            @property
            def proty(cls):
                return 'property'

            def asd(self):
                return 'asd'

        self.assertEqual(ObjectDict(), {})

        self.assertEqual(SimpleObjectDict().int_field, 1)
        self.assertEqual(SimpleObjectDict().str_field, 'a')
        self.assertEqual(SimpleObjectDict().dict_field, {})
        self.assertEqual(SimpleObjectDict(), SimpleObjectDict().from_json(json.dumps(SimpleObjectDict())))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

objectdict-1.0.3.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

objectdict-1.0.3-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file objectdict-1.0.3.tar.gz.

File metadata

  • Download URL: objectdict-1.0.3.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.2

File hashes

Hashes for objectdict-1.0.3.tar.gz
Algorithm Hash digest
SHA256 439d4328085839023cbbb0b8146d7600c8bcb497ef89817c21bac7443ee7b686
MD5 b9ff61a25962fbf1f86936e3fc773b02
BLAKE2b-256 d8cef03ce2d459e274c8f719cb39cd71da52a8efcf7511975ab39721d78d8867

See more details on using hashes here.

File details

Details for the file objectdict-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: objectdict-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.2

File hashes

Hashes for objectdict-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3976352f2f2bd12e19b9e92b7cb133376319dc292362bec64dd804c82f3b60f0
MD5 d6f6a06aa84241c31cc98787e880dd03
BLAKE2b-256 9538d6098e7adf626ad3f67057a2cf98c01476c80e38244c175de89023a37f5e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page