{ "info": { "author": "P C Kroon", "author_email": "p.c.kroon@rug.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Hypothesis", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Testing" ], "description": "# Hypothesis-networkx\n\nThis module provides a Hypothesis strategy for generating networkx graphs.\nThis can be used to efficiently and thoroughly test your code.\n\n## Installation\n\nThis module can be installed via `pip`:\n```\npip install hypothesis-networkx\n```\n\n## User guide\n\nThe module exposes a single function: `graph_builder`. This function is a\nhypothesis composite strategy for building graphs. You can use it as follows:\n\n```python3\nfrom hypothesis_networkx import graph_builder\nfrom hypothesis import strategies as st\nimport networkx as nx\n\nnode_data = st.fixed_dictionaries({'name': st.text(),\n 'number': st.integers()})\nedge_data = st.fixed_dictionaries({'weight': st.floats(allow_nan=False,\n allow_infinity=False)})\n\n\nbuilder = graph_builder(graph_type=nx.Graph,\n node_keys=st.integers(),\n node_data=node_data,\n edge_data=edge_data,\n min_nodes=2, max_nodes=10,\n min_edges=1, max_edges=None,\n self_loops=False,\n connected=True)\n\ngraph = builder.example()\nprint(graph.nodes(data=True))\nprint(graph.edges(data=True))\n```\n\nOf course this builder is a valid hypothesis strategy, and using it to just\nmake examples is not super useful. Instead, you can (and should) use it in\nyour testing framework:\n\n```python3\nfrom hypothesis import given\n\n@given(graph=builder)\ndef test_my_function(graph):\n assert my_function(graph) == known_function(graph)\n\n```\n\nThe meaning of the arguments given to `graph_builder` are pretty\nself-explanatory, but they *must* be given as keyword arguments. \n - `node_data`: The strategy from which node attributes will be drawn.\n - `edge_data`: The strategy from which edge attributes will be drawn.\n - `node_keys`: Either the strategy from which node keys will be draw, or\n None. If None, node keys will be integers from the range (0, number of nodes).\n - `min_nodes` and `max_nodes`: The minimum and maximum number of nodes the \n produced graphs will contain.\n - `min_edges` and `max_edges`: The minimum and maximum number of edges the\n produced graphs will contain. Note that less \n edges than `min_edges` may be added if there \n are not enough nodes, and more than\n `max_edges` if `connected` is True.\n - `graph_type`: This function (or class) will be called without arguments to\n create an empty initial graph.\n - `connected`: If True, the generated graph is guaranteed to be a single\n connected component.\n - `self_loops`: If False, there will be no self-loops in the generated graph.\n Self-loops are edges between a node and itself.\n\n## Known limitations\n\nThere are a few (minor) outstanding issues with this module:\n\n - Graph generation may be slow for large graphs.\n - The `min_edges` argument is not always respected when the produced graph\n is too small.\n - The `max_edges` argument is not always respected if `connected` is True.\n - It currently works for Python 2.7, but this is considered deprecated and\n may stop working without notice.\n\n## See also\n\n[Networkx](https://networkx.github.io/documentation/stable/index.html)\n[Hypothesis](https://hypothesis.readthedocs.io/en/latest/index.html)", "description_content_type": "text/markdown; charset=UTF-8", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pckroon/hypothesis-networkx", "keywords": "hypothesis networkx testing", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "hypothesis-networkx", "package_url": "https://pypi.org/project/hypothesis-networkx/", "platform": "", "project_url": "https://pypi.org/project/hypothesis-networkx/", "project_urls": { "Homepage": "https://github.com/pckroon/hypothesis-networkx" }, "release_url": "https://pypi.org/project/hypothesis-networkx/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "A Hypothesis strategy for generating NetworkX graphs", "version": "0.2.1" }, "last_serial": 5809168, "releases": { "0.0.1.dev15": [ { "comment_text": "", "digests": { "md5": "5f6233df04585a1c8300a1ee138749c0", "sha256": "ce08402882b289baa74d9092652a68dcd0dd7737fb425219506c1b3a4911d71a" }, "downloads": -1, "filename": "hypothesis_networkx-0.0.1.dev15.tar.gz", "has_sig": false, "md5_digest": "5f6233df04585a1c8300a1ee138749c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11499, "upload_time": "2018-08-01T12:08:48", "url": "https://files.pythonhosted.org/packages/71/bd/17c71695c514927856f306720f63a2aec68485c78dcec09c9dfd36392f11/hypothesis_networkx-0.0.1.dev15.tar.gz" } ], "0.0.1.dev16": [ { "comment_text": "", "digests": { "md5": "05d77085571e9e10c6ab98f8be5a743f", "sha256": "4b9b2f6555f47f2e5e8b4cdf585545ad187d5dc6575dd45f69d82088c05eb48c" }, "downloads": -1, "filename": "hypothesis_networkx-0.0.1.dev16.tar.gz", "has_sig": false, "md5_digest": "05d77085571e9e10c6ab98f8be5a743f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11536, "upload_time": "2018-08-01T13:01:01", "url": "https://files.pythonhosted.org/packages/0c/c0/35e0a3628e3c400e373bed02256eb6ef7da67b46452518111014500525c0/hypothesis_networkx-0.0.1.dev16.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "49c2f7a8449d67c3dec285afa30bd1c5", "sha256": "b41c5bd199e153066b82c47f88d356914f3cbfb3972f8854453c9e1e1c0ff859" }, "downloads": -1, "filename": "hypothesis_networkx-0.1.3.tar.gz", "has_sig": false, "md5_digest": "49c2f7a8449d67c3dec285afa30bd1c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11567, "upload_time": "2018-08-01T13:49:00", "url": "https://files.pythonhosted.org/packages/0a/ea/97812aa69c2cf02c3f28683570d4eedaf6f880c8d545c7e61389f6bf1851/hypothesis_networkx-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "cab38c5a9e11ebba8a03527c808fff6d", "sha256": "f0102f2a8a1494eb8f34950be91d9c2ae4787c797f91cf852e409145f28cbae4" }, "downloads": -1, "filename": "hypothesis_networkx-0.1.4.tar.gz", "has_sig": false, "md5_digest": "cab38c5a9e11ebba8a03527c808fff6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12132, "upload_time": "2018-09-10T11:00:55", "url": "https://files.pythonhosted.org/packages/23/3f/64a59d02d731b5420495203ad8619980ce1b34861514d278e8ed2ba4803f/hypothesis_networkx-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "f1714f12d68a459150dc374489098e21", "sha256": "84b6d3c38a954ea576a94df795220c34a76d96afb75384ec2be375e6be7b9716" }, "downloads": -1, "filename": "hypothesis_networkx-0.1.5.tar.gz", "has_sig": false, "md5_digest": "f1714f12d68a459150dc374489098e21", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10962, "upload_time": "2018-12-18T14:55:19", "url": "https://files.pythonhosted.org/packages/33/f1/de773113535e23e3c473b228ec6c132b4316883a0926b1b705fda04b7c78/hypothesis_networkx-0.1.5.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "2a6b602bc5acfa5e5bb63d785b53d4d7", "sha256": "51509fbccefeecc31c33cf57ab9fb9b9c572a483322adfae9a1e73af8b58a30d" }, "downloads": -1, "filename": "hypothesis_networkx-0.2.0.tar.gz", "has_sig": false, "md5_digest": "2a6b602bc5acfa5e5bb63d785b53d4d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11895, "upload_time": "2019-03-21T15:41:46", "url": "https://files.pythonhosted.org/packages/3d/35/25f116cdbbc73bac4931ff4460f2757839956a8c774e186c29dbef4e696d/hypothesis_networkx-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "6db35841e7bfff47fab4a241c936a174", "sha256": "a064010fcf98c5a3d17bae221e56ed8f45dfa86c8aac723d3050bff3753ccb88" }, "downloads": -1, "filename": "hypothesis_networkx-0.2.1.tar.gz", "has_sig": false, "md5_digest": "6db35841e7bfff47fab4a241c936a174", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11611, "upload_time": "2019-09-10T14:04:17", "url": "https://files.pythonhosted.org/packages/d6/f2/75f0bca5a941acd6002c2aa8ae1645e6e44e5be6073c9c467a6ece1ce6e1/hypothesis_networkx-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6db35841e7bfff47fab4a241c936a174", "sha256": "a064010fcf98c5a3d17bae221e56ed8f45dfa86c8aac723d3050bff3753ccb88" }, "downloads": -1, "filename": "hypothesis_networkx-0.2.1.tar.gz", "has_sig": false, "md5_digest": "6db35841e7bfff47fab4a241c936a174", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11611, "upload_time": "2019-09-10T14:04:17", "url": "https://files.pythonhosted.org/packages/d6/f2/75f0bca5a941acd6002c2aa8ae1645e6e44e5be6073c9c467a6ece1ce6e1/hypothesis_networkx-0.2.1.tar.gz" } ] }