{"id":24441668,"url":"https://github.com/pkoscielny/smart_data","last_synced_at":"2026-04-28T10:35:40.986Z","repository":{"id":57468540,"uuid":"342860759","full_name":"pkoscielny/smart_data","owner":"pkoscielny","description":"Smart comparing data for Python tests","archived":false,"fork":false,"pushed_at":"2021-03-10T18:15:08.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-25T01:57:53.267Z","etag":null,"topics":["api","comparison","data-structures","dict","diff","json","list","pytest","python","python3","rest-api","restful","restful-api","structures","test","types","unittest"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pkoscielny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-27T13:16:41.000Z","updated_at":"2021-03-11T15:50:36.000Z","dependencies_parsed_at":"2022-09-19T09:51:21.064Z","dependency_job_id":null,"html_url":"https://github.com/pkoscielny/smart_data","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/pkoscielny/smart_data","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkoscielny%2Fsmart_data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkoscielny%2Fsmart_data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkoscielny%2Fsmart_data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkoscielny%2Fsmart_data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pkoscielny","download_url":"https://codeload.github.com/pkoscielny/smart_data/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkoscielny%2Fsmart_data/sbom","scorecard":{"id":736546,"data":{"date":"2025-08-11","repo":{"name":"github.com/pkoscielny/smart_data","commit":"b7dc6844aca64a07179ab95b50c107b3cf8c18a5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T16:03:21.060Z","repository_id":57468540,"created_at":"2025-08-22T16:03:21.060Z","updated_at":"2025-08-22T16:03:21.060Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32377586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T09:24:15.638Z","status":"ssl_error","status_checked_at":"2026-04-28T09:24:15.071Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","comparison","data-structures","dict","diff","json","list","pytest","python","python3","rest-api","restful","restful-api","structures","test","types","unittest"],"created_at":"2025-01-20T21:18:56.926Z","updated_at":"2026-04-28T10:35:40.958Z","avatar_url":"https://github.com/pkoscielny.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SMART DATA\n\nSMART DATA is a package to make your life easier. For example you want to test many JSON (or any other) results from some API in Python. \nThere are plenty of great Python packages to find differences between two complex structres but sometimes you need to omit some of their parts. \nThis package will help you to write this kind of code easier.\n\n## Requirements\n\nNo package dependecy.\n\n## Installation\n\n```\npip install smart_data\n```\n\n## Functions\n\n### list_diff = include(got, expected) \n* got       - structure to check\n* expected  - structure that is required in 'got' structure. Any difference will be in returned list.\n* list_diff - list with differences, e.g. \n  `['/attributes/temperature/\u003c20.1 vs 22.2\u003e']`\n\nTry to check if `expected` structure includes `got` structure. Any additional keys from `got` will be igroned.\nThis situation can be expected if you don't want to check some parts of complex structure (e.g. in tests).\n\nThe structures should contain dictionaries, lists, objects, simple types or any comparable structures (`__str__` and `__eq__` implementation). \nAdditionally `expected` can be or can contain compiled regular expression (re package) to check e.g. if you don't want to mock datetime objects.\n\n## Example of usage\n\nSo let's try test some endpoint:\n```\nimport re\nre_datetime = re.compile(r\"^\\d{4}-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d$\")\n\ndef test_add_new(self, client):\n    with client:\n        res = client.post(\n            '/air_state',\n            json = {\n                'data': {\n                    'type': 'air_state',\n                    'attributes': {\n                        'temperature': 20.1,\n                        'humidity': 51.2,\n                        'location': 'kitchen',\n                        'device': 'dev1_esp',\n                    },\n                },\n            },\n            content_type = 'application/vnd.api+json',\n        )\n        assert 201 == res.status_code\n        res_json = res.get_json()\n        \n        assert res_json['data']['type'] == 'air_state'\n        assert res_json['data']['id'] == '1'\n        assert res_json['data']['attributes']['temperature'] == '20.1'\n        assert res_json['data']['attributes']['humidity'] == '51.2'\n        assert res_json['data']['attributes']['location'] == 'kitchen'\n        assert res_json['data']['attributes']['device'] == 'dev1_esp'\n        assert re_datetime.search(res_json['data']['attributes']['created'])\n\n```\nYou need to write a bunch of asserts for many items in result structure. Many lines of code. The bigger structure the more code.\n\nNow you can write it other way using smart_data package:\n```\nfrom smart_data import include\nfrom re import compile\n\ndef test_add_new(self, client):\n\n    payload = {\n        'type': 'air_state',\n        'attributes': {\n            'temperature': 20.1,\n            'humidity': 51.2,\n            'location': 'kitchen',\n            'device': 'dev1_esp',\n        },\n    }\n\n    with client:\n        res = client.post(\n            '/air_state',\n            json = { 'data': payload },\n            content_type = 'application/vnd.api+json',\n        )\n        assert 201 == res.status_code\n\n        payload['attributes']['id'] = 1\n        payload['attributes']['created'] = compile(r\"^\\d{4}-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d$\")\n        res_json = res.get_json()\n        assert include(got=res_json['data'], expected=payload) == []\n```\nThis is a simple example with a really small amount of data to test. For more complex structures the benefit is higher.\n\nThe next benefit is readable output from broken assert during tests. For example:\n```\n    def test_foo():\n        expected = {\n            'foo': 1.1,\n            'bar': [42, {'baz': 22}],\n            'zoo': None,\n            'zar': [[1, 3], [5, 8]],\n        }\n        got = {\n            'foo': 1.1,\n            'bar': [42, {'baz': 2}],\n            'zoo': None,\n            'zar': [[1, 3], [5, 8]],\n        }\n\u003e       assert include(got, expected) == []\nE       AssertionError: assert ['/bar/1/baz/\u003c2 vs 22\u003e'] == []\nE         Left contains one more item: '/bar/1/baz/\u003c2 vs 22\u003e'\nE         Full diff:\nE         - []\nE         + ['/bar/1/baz/\u003c2 vs 22\u003e']\n\ntests/test_include.py:38: AssertionError\n```\n\nEnjoy!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkoscielny%2Fsmart_data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpkoscielny%2Fsmart_data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkoscielny%2Fsmart_data/lists"}