okstra 0.113.0 → 0.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.kr.md +2 -2
- package/README.md +2 -2
- package/docs/for-ai/README.md +2 -2
- package/docs/for-ai/skills/{okstra-brief.md → okstra-brief-gen.md} +3 -3
- package/docs/for-ai/skills/okstra-inspect.md +1 -1
- package/docs/kr/architecture.md +11 -11
- package/docs/kr/cli.md +1 -1
- package/docs/kr/follow-ups/2026-07-10-final-report-option-3.md +51 -0
- package/docs/project-structure-overview.md +2 -2
- package/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/agents/workers/report-writer-worker.md +1 -0
- package/runtime/prompts/lead/context-loader.md +2 -2
- package/runtime/prompts/lead/okstra-lead-contract.md +1 -1
- package/runtime/prompts/profiles/_common-contract.md +3 -3
- package/runtime/prompts/profiles/implementation-planning.md +1 -1
- package/runtime/prompts/profiles/requirements-discovery.md +2 -2
- package/runtime/python/okstra_ctl/fix_cycles.py +1 -1
- package/runtime/python/okstra_ctl/implementation_stage.py +46 -39
- package/runtime/python/okstra_ctl/report_views.py +151 -12
- package/runtime/python/okstra_ctl/run.py +24 -24
- package/runtime/python/okstra_ctl/wizard.py +3 -3
- package/runtime/python/okstra_ctl/worktree.py +1 -1
- package/runtime/python/okstra_token_usage/claude.py +58 -19
- package/runtime/python/okstra_token_usage/collect.py +3 -1
- package/runtime/python/okstra_vendor/__init__.py +3 -0
- package/runtime/schemas/final-report-v1.0.schema.json +20 -0
- package/runtime/skills/{okstra-brief → okstra-brief-gen}/SKILL.md +6 -6
- package/runtime/skills/{okstra-brief → okstra-brief-gen}/references/reporter-confirmations.md +1 -1
- package/runtime/skills/{okstra-brief → okstra-brief-gen}/references/tracker-recursion.md +1 -1
- package/runtime/skills/okstra-inspect/SKILL.md +2 -2
- package/runtime/templates/reports/brief.template.md +2 -2
- package/runtime/templates/reports/final-report.template.md +14 -0
- package/runtime/templates/reports/i18n/en.json +23 -12
- package/runtime/templates/reports/i18n/ko.json +23 -12
- package/runtime/templates/reports/report.css +55 -0
- package/runtime/templates/reports/report.js +53 -1
- package/runtime/validators/validate-brief.py +5 -5
- package/runtime/validators/validate-brief.sh +1 -1
- package/src/commands/lifecycle/uninstall.mjs +2 -1
- package/src/lib/skill-catalog.mjs +2 -1
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_approx_clust_coeff.py +0 -41
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_clique.py +0 -112
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_connectivity.py +0 -199
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_density.py +0 -146
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_distance_measures.py +0 -59
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_dominating_set.py +0 -78
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_kcomponents.py +0 -303
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_matching.py +0 -8
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_maxcut.py +0 -94
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_ramsey.py +0 -31
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_steinertree.py +0 -306
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_traveling_salesman.py +0 -1014
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_treewidth.py +0 -274
- package/runtime/python/okstra_vendor/networkx/algorithms/approximation/tests/test_vertex_cover.py +0 -68
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/base_test.py +0 -81
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_connectivity.py +0 -143
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_correlation.py +0 -122
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_mixing.py +0 -174
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_neighbor_degree.py +0 -107
- package/runtime/python/okstra_vendor/networkx/algorithms/assortativity/tests/test_pairs.py +0 -87
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_basic.py +0 -125
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_centrality.py +0 -192
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_cluster.py +0 -84
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_covering.py +0 -33
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_edgelist.py +0 -240
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_extendability.py +0 -334
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_generators.py +0 -407
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_link_analysis.py +0 -218
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matching.py +0 -327
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_matrix.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_project.py +0 -409
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_redundancy.py +0 -35
- package/runtime/python/okstra_vendor/networkx/algorithms/bipartite/tests/test_spectral_bipartivity.py +0 -80
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality.py +0 -923
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_betweenness_centrality_subset.py +0 -354
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_closeness_centrality.py +0 -274
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality.py +0 -259
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_betweenness_centrality_subset.py +0 -147
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_current_flow_closeness.py +0 -43
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_degree_centrality.py +0 -144
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_dispersion.py +0 -73
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_eigenvector_centrality.py +0 -186
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_group.py +0 -277
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_harmonic_centrality.py +0 -122
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_katz_centrality.py +0 -345
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_laplacian_centrality.py +0 -220
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_load_centrality.py +0 -344
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_percolation_centrality.py +0 -87
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_reaching.py +0 -140
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_second_order_centrality.py +0 -82
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_subgraph.py +0 -110
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_trophic.py +0 -302
- package/runtime/python/okstra_vendor/networkx/algorithms/centrality/tests/test_voterank.py +0 -64
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/coloring/tests/test_coloring.py +0 -863
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_asyn_fluid.py +0 -147
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_bipartitions.py +0 -157
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_centrality.py +0 -85
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_divisive.py +0 -106
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_kclique.py +0 -91
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_label_propagation.py +0 -241
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_leiden.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_local.py +0 -76
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_louvain.py +0 -264
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_lukes.py +0 -152
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_modularity_max.py +0 -340
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_quality.py +0 -139
- package/runtime/python/okstra_vendor/networkx/algorithms/community/tests/test_utils.py +0 -26
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_attracting.py +0 -70
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_biconnected.py +0 -248
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_connected.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_semiconnected.py +0 -55
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_strongly_connected.py +0 -193
- package/runtime/python/okstra_vendor/networkx/algorithms/components/tests/test_weakly_connected.py +0 -96
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_connectivity.py +0 -421
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_cuts.py +0 -309
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_disjoint_paths.py +0 -249
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_augmentation.py +0 -502
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_edge_kcomponents.py +0 -488
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcomponents.py +0 -323
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_kcutsets.py +0 -280
- package/runtime/python/okstra_vendor/networkx/algorithms/connectivity/tests/test_stoer_wagner.py +0 -102
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/gl1.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/gw1.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/netgen-2.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_gomory_hu.py +0 -128
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow.py +0 -573
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_maxflow_large_graph.py +0 -155
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_mincost.py +0 -475
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/test_networksimplex.py +0 -481
- package/runtime/python/okstra_vendor/networkx/algorithms/flow/tests/wlm3.gpickle.bz2 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/iso_r01_s80.A99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/iso_r01_s80.B99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/si2_b06_m200.A99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/si2_b06_m200.B99 +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_ismags.py +0 -719
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphism.py +0 -103
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_isomorphvf2.py +0 -490
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_match_helpers.py +0 -64
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_temporalisomorphvf2.py +0 -212
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_tree_isomorphism.py +0 -202
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp.py +0 -1655
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2pp_helpers.py +0 -3118
- package/runtime/python/okstra_vendor/networkx/algorithms/isomorphism/tests/test_vf2userfunc.py +0 -196
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_hits.py +0 -77
- package/runtime/python/okstra_vendor/networkx/algorithms/link_analysis/tests/test_pagerank.py +0 -213
- package/runtime/python/okstra_vendor/networkx/algorithms/minors/tests/test_contraction.py +0 -544
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_all.py +0 -328
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_binary.py +0 -451
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_product.py +0 -491
- package/runtime/python/okstra_vendor/networkx/algorithms/operators/tests/test_unary.py +0 -55
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_astar.py +0 -254
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense.py +0 -212
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_dense_numpy.py +0 -88
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_generic.py +0 -511
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_unweighted.py +0 -149
- package/runtime/python/okstra_vendor/networkx/algorithms/shortest_paths/tests/test_weighted.py +0 -983
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_asteroidal.py +0 -23
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_boundary.py +0 -154
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_bridges.py +0 -144
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_broadcasting.py +0 -109
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chains.py +0 -136
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_chordal.py +0 -129
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_clique.py +0 -300
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cluster.py +0 -678
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_communicability.py +0 -80
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_core.py +0 -266
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_covering.py +0 -85
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cuts.py +0 -171
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_cycles.py +0 -984
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_d_separation.py +0 -340
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dag.py +0 -835
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_measures.py +0 -831
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_distance_regular.py +0 -85
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominance.py +0 -299
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_dominating.py +0 -115
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_efficiency.py +0 -58
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_euler.py +0 -314
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graph_hashing.py +0 -872
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_graphical.py +0 -163
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hierarchy.py +0 -46
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_hybrid.py +0 -24
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_isolate.py +0 -26
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_link_prediction.py +0 -615
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_lowest_common_ancestors.py +0 -459
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_matching.py +0 -556
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_max_weight_clique.py +0 -179
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_mis.py +0 -62
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_moral.py +0 -15
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_node_classification.py +0 -140
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_non_randomness.py +0 -60
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_perfect_graph.py +0 -27
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planar_drawing.py +0 -274
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_planarity.py +0 -556
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_polynomials.py +0 -57
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_reciprocity.py +0 -37
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_regular.py +0 -88
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_richclub.py +0 -149
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_similarity.py +0 -1158
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_simple_paths.py +0 -803
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smallworld.py +0 -76
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_smetric.py +0 -8
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_sparsifiers.py +0 -138
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_structuralholes.py +0 -191
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_summarization.py +0 -642
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_swap.py +0 -179
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_threshold.py +0 -270
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_time_dependent.py +0 -431
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_tournament.py +0 -161
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_triads.py +0 -248
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_vitality.py +0 -41
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_voronoi.py +0 -103
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_walks.py +0 -54
- package/runtime/python/okstra_vendor/networkx/algorithms/tests/test_wiener.py +0 -157
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_beamsearch.py +0 -25
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_bfs.py +0 -203
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_dfs.py +0 -307
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgebfs.py +0 -147
- package/runtime/python/okstra_vendor/networkx/algorithms/traversal/tests/test_edgedfs.py +0 -131
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_branchings.py +0 -624
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_coding.py +0 -114
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_decomposition.py +0 -79
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_distance_measures.py +0 -99
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_mst.py +0 -934
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_operations.py +0 -53
- package/runtime/python/okstra_vendor/networkx/algorithms/tree/tests/test_recognition.py +0 -174
- package/runtime/python/okstra_vendor/networkx/classes/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/classes/tests/dispatch_interface.py +0 -192
- package/runtime/python/okstra_vendor/networkx/classes/tests/historical_tests.py +0 -476
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_coreviews.py +0 -362
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph.py +0 -331
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_digraph_historical.py +0 -110
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_filters.py +0 -177
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_function.py +0 -1045
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph.py +0 -950
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graph_historical.py +0 -12
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_graphviews.py +0 -349
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_multidigraph.py +0 -459
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_multigraph.py +0 -528
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_reportviews.py +0 -1421
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_special.py +0 -131
- package/runtime/python/okstra_vendor/networkx/classes/tests/test_subgraphviews.py +0 -371
- package/runtime/python/okstra_vendor/networkx/conftest.py +0 -261
- package/runtime/python/okstra_vendor/networkx/drawing/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_complex.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_empty_graph.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_house_with_colors.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_labels_and_colors.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_display_shortest_path.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/baseline/test_house_with_colors.png +0 -0
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_agraph.py +0 -237
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_image_comparison_pylab_mpl.py +0 -229
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_latex.py +0 -285
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_layout.py +0 -631
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pydot.py +0 -146
- package/runtime/python/okstra_vendor/networkx/drawing/tests/test_pylab.py +0 -1582
- package/runtime/python/okstra_vendor/networkx/generators/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_atlas.py +0 -75
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_classic.py +0 -642
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_cographs.py +0 -20
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_community.py +0 -362
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_degree_seq.py +0 -224
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_directed.py +0 -189
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_duplication.py +0 -103
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_ego.py +0 -39
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_expanders.py +0 -182
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_geometric.py +0 -488
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_harary_graph.py +0 -133
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_internet_as_graphs.py +0 -221
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_intersection.py +0 -28
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_interval_graph.py +0 -144
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_joint_degree_seq.py +0 -125
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_lattice.py +0 -264
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_line.py +0 -316
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_mycielski.py +0 -30
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_nonisomorphic_trees.py +0 -82
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_clustered.py +0 -33
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_random_graphs.py +0 -495
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_small.py +0 -220
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_spectral_graph_forge.py +0 -49
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_stochastic.py +0 -72
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_sudoku.py +0 -92
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_time_series.py +0 -64
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_trees.py +0 -195
- package/runtime/python/okstra_vendor/networkx/generators/tests/test_triads.py +0 -15
- package/runtime/python/okstra_vendor/networkx/linalg/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_algebraic_connectivity.py +0 -400
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_attrmatrix.py +0 -108
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_bethehessian.py +0 -40
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_graphmatrix.py +0 -275
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_laplacian.py +0 -334
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_modularity.py +0 -86
- package/runtime/python/okstra_vendor/networkx/linalg/tests/test_spectrum.py +0 -70
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_adjacency.py +0 -78
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_cytoscape.py +0 -78
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_node_link.py +0 -109
- package/runtime/python/okstra_vendor/networkx/readwrite/json_graph/tests/test_tree.py +0 -48
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_adjlist.py +0 -354
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_edgelist.py +0 -318
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gexf.py +0 -612
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_gml.py +0 -744
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graph6.py +0 -181
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_graphml.py +0 -1531
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_leda.py +0 -30
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_p2g.py +0 -63
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_pajek.py +0 -128
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_sparse6.py +0 -166
- package/runtime/python/okstra_vendor/networkx/readwrite/tests/test_text.py +0 -1742
- package/runtime/python/okstra_vendor/networkx/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/tests/test_all_random_functions.py +0 -248
- package/runtime/python/okstra_vendor/networkx/tests/test_convert.py +0 -321
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_numpy.py +0 -531
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_pandas.py +0 -349
- package/runtime/python/okstra_vendor/networkx/tests/test_convert_scipy.py +0 -281
- package/runtime/python/okstra_vendor/networkx/tests/test_exceptions.py +0 -40
- package/runtime/python/okstra_vendor/networkx/tests/test_import.py +0 -11
- package/runtime/python/okstra_vendor/networkx/tests/test_lazy_imports.py +0 -96
- package/runtime/python/okstra_vendor/networkx/tests/test_relabel.py +0 -349
- package/runtime/python/okstra_vendor/networkx/tests/test_removed_functions_exception_messages.py +0 -8
- package/runtime/python/okstra_vendor/networkx/utils/tests/__init__.py +0 -0
- package/runtime/python/okstra_vendor/networkx/utils/tests/test__init.py +0 -11
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_backends.py +0 -225
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_config.py +0 -263
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_decorators.py +0 -510
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_heaps.py +0 -131
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_mapped_queue.py +0 -268
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_misc.py +0 -393
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_random_sequence.py +0 -53
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_rcm.py +0 -63
- package/runtime/python/okstra_vendor/networkx/utils/tests/test_unionfind.py +0 -55
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
import pickle
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
|
|
5
|
-
import networkx as nx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TestAtlasView:
|
|
9
|
-
# node->data
|
|
10
|
-
def setup_method(self):
|
|
11
|
-
self.d = {0: {"color": "blue", "weight": 1.2}, 1: {}, 2: {"color": 1}}
|
|
12
|
-
self.av = nx.classes.coreviews.AtlasView(self.d)
|
|
13
|
-
|
|
14
|
-
def test_pickle(self):
|
|
15
|
-
view = self.av
|
|
16
|
-
pview = pickle.loads(pickle.dumps(view, -1))
|
|
17
|
-
assert view == pview
|
|
18
|
-
assert view.__slots__ == pview.__slots__
|
|
19
|
-
pview = pickle.loads(pickle.dumps(view))
|
|
20
|
-
assert view == pview
|
|
21
|
-
assert view.__slots__ == pview.__slots__
|
|
22
|
-
|
|
23
|
-
def test_len(self):
|
|
24
|
-
assert len(self.av) == len(self.d)
|
|
25
|
-
|
|
26
|
-
def test_iter(self):
|
|
27
|
-
assert list(self.av) == list(self.d)
|
|
28
|
-
|
|
29
|
-
def test_getitem(self):
|
|
30
|
-
assert self.av[1] is self.d[1]
|
|
31
|
-
assert self.av[2]["color"] == 1
|
|
32
|
-
pytest.raises(KeyError, self.av.__getitem__, 3)
|
|
33
|
-
|
|
34
|
-
def test_copy(self):
|
|
35
|
-
avcopy = self.av.copy()
|
|
36
|
-
assert avcopy[0] == self.av[0]
|
|
37
|
-
assert avcopy == self.av
|
|
38
|
-
assert avcopy[0] is not self.av[0]
|
|
39
|
-
assert avcopy is not self.av
|
|
40
|
-
avcopy[5] = {}
|
|
41
|
-
assert avcopy != self.av
|
|
42
|
-
|
|
43
|
-
avcopy[0]["ht"] = 4
|
|
44
|
-
assert avcopy[0] != self.av[0]
|
|
45
|
-
self.av[0]["ht"] = 4
|
|
46
|
-
assert avcopy[0] == self.av[0]
|
|
47
|
-
del self.av[0]["ht"]
|
|
48
|
-
|
|
49
|
-
assert not hasattr(self.av, "__setitem__")
|
|
50
|
-
|
|
51
|
-
def test_items(self):
|
|
52
|
-
assert sorted(self.av.items()) == sorted(self.d.items())
|
|
53
|
-
|
|
54
|
-
def test_str(self):
|
|
55
|
-
out = str(self.d)
|
|
56
|
-
assert str(self.av) == out
|
|
57
|
-
|
|
58
|
-
def test_repr(self):
|
|
59
|
-
out = "AtlasView(" + str(self.d) + ")"
|
|
60
|
-
assert repr(self.av) == out
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
class TestAdjacencyView:
|
|
64
|
-
# node->nbr->data
|
|
65
|
-
def setup_method(self):
|
|
66
|
-
dd = {"color": "blue", "weight": 1.2}
|
|
67
|
-
self.nd = {0: dd, 1: {}, 2: {"color": 1}}
|
|
68
|
-
self.adj = {3: self.nd, 0: {3: dd}, 1: {}, 2: {3: {"color": 1}}}
|
|
69
|
-
self.adjview = nx.classes.coreviews.AdjacencyView(self.adj)
|
|
70
|
-
|
|
71
|
-
def test_pickle(self):
|
|
72
|
-
view = self.adjview
|
|
73
|
-
pview = pickle.loads(pickle.dumps(view, -1))
|
|
74
|
-
assert view == pview
|
|
75
|
-
assert view.__slots__ == pview.__slots__
|
|
76
|
-
|
|
77
|
-
def test_len(self):
|
|
78
|
-
assert len(self.adjview) == len(self.adj)
|
|
79
|
-
|
|
80
|
-
def test_iter(self):
|
|
81
|
-
assert list(self.adjview) == list(self.adj)
|
|
82
|
-
|
|
83
|
-
def test_getitem(self):
|
|
84
|
-
assert self.adjview[1] is not self.adj[1]
|
|
85
|
-
assert self.adjview[3][0] is self.adjview[0][3]
|
|
86
|
-
assert self.adjview[2][3]["color"] == 1
|
|
87
|
-
pytest.raises(KeyError, self.adjview.__getitem__, 4)
|
|
88
|
-
|
|
89
|
-
def test_copy(self):
|
|
90
|
-
avcopy = self.adjview.copy()
|
|
91
|
-
assert avcopy[0] == self.adjview[0]
|
|
92
|
-
assert avcopy[0] is not self.adjview[0]
|
|
93
|
-
|
|
94
|
-
avcopy[2][3]["ht"] = 4
|
|
95
|
-
assert avcopy[2] != self.adjview[2]
|
|
96
|
-
self.adjview[2][3]["ht"] = 4
|
|
97
|
-
assert avcopy[2] == self.adjview[2]
|
|
98
|
-
del self.adjview[2][3]["ht"]
|
|
99
|
-
|
|
100
|
-
assert not hasattr(self.adjview, "__setitem__")
|
|
101
|
-
|
|
102
|
-
def test_items(self):
|
|
103
|
-
view_items = sorted((n, dict(d)) for n, d in self.adjview.items())
|
|
104
|
-
assert view_items == sorted(self.adj.items())
|
|
105
|
-
|
|
106
|
-
def test_str(self):
|
|
107
|
-
out = str(dict(self.adj))
|
|
108
|
-
assert str(self.adjview) == out
|
|
109
|
-
|
|
110
|
-
def test_repr(self):
|
|
111
|
-
out = self.adjview.__class__.__name__ + "(" + str(self.adj) + ")"
|
|
112
|
-
assert repr(self.adjview) == out
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
class TestMultiAdjacencyView(TestAdjacencyView):
|
|
116
|
-
# node->nbr->key->data
|
|
117
|
-
def setup_method(self):
|
|
118
|
-
dd = {"color": "blue", "weight": 1.2}
|
|
119
|
-
self.kd = {0: dd, 1: {}, 2: {"color": 1}}
|
|
120
|
-
self.nd = {3: self.kd, 0: {3: dd}, 1: {0: {}}, 2: {3: {"color": 1}}}
|
|
121
|
-
self.adj = {3: self.nd, 0: {3: {3: dd}}, 1: {}, 2: {3: {8: {}}}}
|
|
122
|
-
self.adjview = nx.classes.coreviews.MultiAdjacencyView(self.adj)
|
|
123
|
-
|
|
124
|
-
def test_getitem(self):
|
|
125
|
-
assert self.adjview[1] is not self.adj[1]
|
|
126
|
-
assert self.adjview[3][0][3] is self.adjview[0][3][3]
|
|
127
|
-
assert self.adjview[3][2][3]["color"] == 1
|
|
128
|
-
pytest.raises(KeyError, self.adjview.__getitem__, 4)
|
|
129
|
-
|
|
130
|
-
def test_copy(self):
|
|
131
|
-
avcopy = self.adjview.copy()
|
|
132
|
-
assert avcopy[0] == self.adjview[0]
|
|
133
|
-
assert avcopy[0] is not self.adjview[0]
|
|
134
|
-
|
|
135
|
-
avcopy[2][3][8]["ht"] = 4
|
|
136
|
-
assert avcopy[2] != self.adjview[2]
|
|
137
|
-
self.adjview[2][3][8]["ht"] = 4
|
|
138
|
-
assert avcopy[2] == self.adjview[2]
|
|
139
|
-
del self.adjview[2][3][8]["ht"]
|
|
140
|
-
|
|
141
|
-
assert not hasattr(self.adjview, "__setitem__")
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
class TestUnionAtlas:
|
|
145
|
-
# node->data
|
|
146
|
-
def setup_method(self):
|
|
147
|
-
self.s = {0: {"color": "blue", "weight": 1.2}, 1: {}, 2: {"color": 1}}
|
|
148
|
-
self.p = {3: {"color": "blue", "weight": 1.2}, 4: {}, 2: {"watch": 2}}
|
|
149
|
-
self.av = nx.classes.coreviews.UnionAtlas(self.s, self.p)
|
|
150
|
-
|
|
151
|
-
def test_pickle(self):
|
|
152
|
-
view = self.av
|
|
153
|
-
pview = pickle.loads(pickle.dumps(view, -1))
|
|
154
|
-
assert view == pview
|
|
155
|
-
assert view.__slots__ == pview.__slots__
|
|
156
|
-
|
|
157
|
-
def test_len(self):
|
|
158
|
-
assert len(self.av) == len(self.s.keys() | self.p.keys()) == 5
|
|
159
|
-
|
|
160
|
-
def test_iter(self):
|
|
161
|
-
assert set(self.av) == set(self.s) | set(self.p)
|
|
162
|
-
|
|
163
|
-
def test_getitem(self):
|
|
164
|
-
assert self.av[0] is self.s[0]
|
|
165
|
-
assert self.av[4] is self.p[4]
|
|
166
|
-
assert self.av[2]["color"] == 1
|
|
167
|
-
pytest.raises(KeyError, self.av[2].__getitem__, "watch")
|
|
168
|
-
pytest.raises(KeyError, self.av.__getitem__, 8)
|
|
169
|
-
|
|
170
|
-
def test_copy(self):
|
|
171
|
-
avcopy = self.av.copy()
|
|
172
|
-
assert avcopy[0] == self.av[0]
|
|
173
|
-
assert avcopy[0] is not self.av[0]
|
|
174
|
-
assert avcopy is not self.av
|
|
175
|
-
avcopy[5] = {}
|
|
176
|
-
assert avcopy != self.av
|
|
177
|
-
|
|
178
|
-
avcopy[0]["ht"] = 4
|
|
179
|
-
assert avcopy[0] != self.av[0]
|
|
180
|
-
self.av[0]["ht"] = 4
|
|
181
|
-
assert avcopy[0] == self.av[0]
|
|
182
|
-
del self.av[0]["ht"]
|
|
183
|
-
|
|
184
|
-
assert not hasattr(self.av, "__setitem__")
|
|
185
|
-
|
|
186
|
-
def test_items(self):
|
|
187
|
-
expected = dict(self.p.items())
|
|
188
|
-
expected.update(self.s)
|
|
189
|
-
assert sorted(self.av.items()) == sorted(expected.items())
|
|
190
|
-
|
|
191
|
-
def test_str(self):
|
|
192
|
-
out = str(dict(self.av))
|
|
193
|
-
assert str(self.av) == out
|
|
194
|
-
|
|
195
|
-
def test_repr(self):
|
|
196
|
-
out = f"{self.av.__class__.__name__}({self.s}, {self.p})"
|
|
197
|
-
assert repr(self.av) == out
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
class TestUnionAdjacency:
|
|
201
|
-
# node->nbr->data
|
|
202
|
-
def setup_method(self):
|
|
203
|
-
dd = {"color": "blue", "weight": 1.2}
|
|
204
|
-
self.nd = {0: dd, 1: {}, 2: {"color": 1}}
|
|
205
|
-
self.s = {3: self.nd, 0: {}, 1: {}, 2: {3: {"color": 1}}}
|
|
206
|
-
self.p = {3: {}, 0: {3: dd}, 1: {0: {}}, 2: {1: {"color": 1}}}
|
|
207
|
-
self.adjview = nx.classes.coreviews.UnionAdjacency(self.s, self.p)
|
|
208
|
-
|
|
209
|
-
def test_pickle(self):
|
|
210
|
-
view = self.adjview
|
|
211
|
-
pview = pickle.loads(pickle.dumps(view, -1))
|
|
212
|
-
assert view == pview
|
|
213
|
-
assert view.__slots__ == pview.__slots__
|
|
214
|
-
|
|
215
|
-
def test_len(self):
|
|
216
|
-
assert len(self.adjview) == len(self.s)
|
|
217
|
-
|
|
218
|
-
def test_iter(self):
|
|
219
|
-
assert sorted(self.adjview) == sorted(self.s)
|
|
220
|
-
|
|
221
|
-
def test_getitem(self):
|
|
222
|
-
assert self.adjview[1] is not self.s[1]
|
|
223
|
-
assert self.adjview[3][0] is self.adjview[0][3]
|
|
224
|
-
assert self.adjview[2][3]["color"] == 1
|
|
225
|
-
pytest.raises(KeyError, self.adjview.__getitem__, 4)
|
|
226
|
-
|
|
227
|
-
def test_copy(self):
|
|
228
|
-
avcopy = self.adjview.copy()
|
|
229
|
-
assert avcopy[0] == self.adjview[0]
|
|
230
|
-
assert avcopy[0] is not self.adjview[0]
|
|
231
|
-
|
|
232
|
-
avcopy[2][3]["ht"] = 4
|
|
233
|
-
assert avcopy[2] != self.adjview[2]
|
|
234
|
-
self.adjview[2][3]["ht"] = 4
|
|
235
|
-
assert avcopy[2] == self.adjview[2]
|
|
236
|
-
del self.adjview[2][3]["ht"]
|
|
237
|
-
|
|
238
|
-
assert not hasattr(self.adjview, "__setitem__")
|
|
239
|
-
|
|
240
|
-
def test_str(self):
|
|
241
|
-
out = str(dict(self.adjview))
|
|
242
|
-
assert str(self.adjview) == out
|
|
243
|
-
|
|
244
|
-
def test_repr(self):
|
|
245
|
-
clsname = self.adjview.__class__.__name__
|
|
246
|
-
out = f"{clsname}({self.s}, {self.p})"
|
|
247
|
-
assert repr(self.adjview) == out
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
class TestUnionMultiInner(TestUnionAdjacency):
|
|
251
|
-
# nbr->key->data
|
|
252
|
-
def setup_method(self):
|
|
253
|
-
dd = {"color": "blue", "weight": 1.2}
|
|
254
|
-
self.kd = {7: {}, "ekey": {}, 9: {"color": 1}}
|
|
255
|
-
self.s = {3: self.kd, 0: {7: dd}, 1: {}, 2: {"key": {"color": 1}}}
|
|
256
|
-
self.p = {3: {}, 0: {3: dd}, 1: {}, 2: {1: {"span": 2}}}
|
|
257
|
-
self.adjview = nx.classes.coreviews.UnionMultiInner(self.s, self.p)
|
|
258
|
-
|
|
259
|
-
def test_len(self):
|
|
260
|
-
assert len(self.adjview) == len(self.s.keys() | self.p.keys()) == 4
|
|
261
|
-
|
|
262
|
-
def test_getitem(self):
|
|
263
|
-
assert self.adjview[1] is not self.s[1]
|
|
264
|
-
assert self.adjview[0][7] is self.adjview[0][3]
|
|
265
|
-
assert self.adjview[2]["key"]["color"] == 1
|
|
266
|
-
assert self.adjview[2][1]["span"] == 2
|
|
267
|
-
pytest.raises(KeyError, self.adjview.__getitem__, 4)
|
|
268
|
-
pytest.raises(KeyError, self.adjview[1].__getitem__, "key")
|
|
269
|
-
|
|
270
|
-
def test_copy(self):
|
|
271
|
-
avcopy = self.adjview.copy()
|
|
272
|
-
assert avcopy[0] == self.adjview[0]
|
|
273
|
-
assert avcopy[0] is not self.adjview[0]
|
|
274
|
-
|
|
275
|
-
avcopy[2][1]["width"] = 8
|
|
276
|
-
assert avcopy[2] != self.adjview[2]
|
|
277
|
-
self.adjview[2][1]["width"] = 8
|
|
278
|
-
assert avcopy[2] == self.adjview[2]
|
|
279
|
-
del self.adjview[2][1]["width"]
|
|
280
|
-
|
|
281
|
-
assert not hasattr(self.adjview, "__setitem__")
|
|
282
|
-
assert hasattr(avcopy, "__setitem__")
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
class TestUnionMultiAdjacency(TestUnionAdjacency):
|
|
286
|
-
# node->nbr->key->data
|
|
287
|
-
def setup_method(self):
|
|
288
|
-
dd = {"color": "blue", "weight": 1.2}
|
|
289
|
-
self.kd = {7: {}, 8: {}, 9: {"color": 1}}
|
|
290
|
-
self.nd = {3: self.kd, 0: {9: dd}, 1: {8: {}}, 2: {9: {"color": 1}}}
|
|
291
|
-
self.s = {3: self.nd, 0: {3: {7: dd}}, 1: {}, 2: {3: {8: {}}}}
|
|
292
|
-
self.p = {3: {}, 0: {3: {9: dd}}, 1: {}, 2: {1: {8: {}}}}
|
|
293
|
-
self.adjview = nx.classes.coreviews.UnionMultiAdjacency(self.s, self.p)
|
|
294
|
-
|
|
295
|
-
def test_getitem(self):
|
|
296
|
-
assert self.adjview[1] is not self.s[1]
|
|
297
|
-
assert self.adjview[3][0][9] is self.adjview[0][3][9]
|
|
298
|
-
assert self.adjview[3][2][9]["color"] == 1
|
|
299
|
-
pytest.raises(KeyError, self.adjview.__getitem__, 4)
|
|
300
|
-
|
|
301
|
-
def test_copy(self):
|
|
302
|
-
avcopy = self.adjview.copy()
|
|
303
|
-
assert avcopy[0] == self.adjview[0]
|
|
304
|
-
assert avcopy[0] is not self.adjview[0]
|
|
305
|
-
|
|
306
|
-
avcopy[2][3][8]["ht"] = 4
|
|
307
|
-
assert avcopy[2] != self.adjview[2]
|
|
308
|
-
self.adjview[2][3][8]["ht"] = 4
|
|
309
|
-
assert avcopy[2] == self.adjview[2]
|
|
310
|
-
del self.adjview[2][3][8]["ht"]
|
|
311
|
-
|
|
312
|
-
assert not hasattr(self.adjview, "__setitem__")
|
|
313
|
-
assert hasattr(avcopy, "__setitem__")
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
class TestFilteredGraphs:
|
|
317
|
-
def setup_method(self):
|
|
318
|
-
self.Graphs = [nx.Graph, nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph]
|
|
319
|
-
|
|
320
|
-
def test_hide_show_nodes(self):
|
|
321
|
-
SubGraph = nx.subgraph_view
|
|
322
|
-
for Graph in self.Graphs:
|
|
323
|
-
G = nx.path_graph(4, Graph)
|
|
324
|
-
SG = G.subgraph([2, 3])
|
|
325
|
-
RG = SubGraph(G, filter_node=nx.filters.hide_nodes([0, 1]))
|
|
326
|
-
assert SG.nodes == RG.nodes
|
|
327
|
-
assert SG.edges == RG.edges
|
|
328
|
-
SGC = SG.copy()
|
|
329
|
-
RGC = RG.copy()
|
|
330
|
-
assert SGC.nodes == RGC.nodes
|
|
331
|
-
assert SGC.edges == RGC.edges
|
|
332
|
-
|
|
333
|
-
def test_str_repr(self):
|
|
334
|
-
SubGraph = nx.subgraph_view
|
|
335
|
-
for Graph in self.Graphs:
|
|
336
|
-
G = nx.path_graph(4, Graph)
|
|
337
|
-
SG = G.subgraph([2, 3])
|
|
338
|
-
RG = SubGraph(G, filter_node=nx.filters.hide_nodes([0, 1]))
|
|
339
|
-
str(SG.adj)
|
|
340
|
-
str(RG.adj)
|
|
341
|
-
repr(SG.adj)
|
|
342
|
-
repr(RG.adj)
|
|
343
|
-
str(SG.adj[2])
|
|
344
|
-
str(RG.adj[2])
|
|
345
|
-
repr(SG.adj[2])
|
|
346
|
-
repr(RG.adj[2])
|
|
347
|
-
|
|
348
|
-
def test_copy(self):
|
|
349
|
-
SubGraph = nx.subgraph_view
|
|
350
|
-
for Graph in self.Graphs:
|
|
351
|
-
G = nx.path_graph(4, Graph)
|
|
352
|
-
SG = G.subgraph([2, 3])
|
|
353
|
-
RG = SubGraph(G, filter_node=nx.filters.hide_nodes([0, 1]))
|
|
354
|
-
RsG = SubGraph(G, filter_node=nx.filters.show_nodes([2, 3]))
|
|
355
|
-
assert G.adj.copy() == G.adj
|
|
356
|
-
assert G.adj[2].copy() == G.adj[2]
|
|
357
|
-
assert SG.adj.copy() == SG.adj
|
|
358
|
-
assert SG.adj[2].copy() == SG.adj[2]
|
|
359
|
-
assert RG.adj.copy() == RG.adj
|
|
360
|
-
assert RG.adj[2].copy() == RG.adj[2]
|
|
361
|
-
assert RsG.adj.copy() == RsG.adj
|
|
362
|
-
assert RsG.adj[2].copy() == RsG.adj[2]
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
import networkx as nx
|
|
4
|
-
from networkx.utils import nodes_equal
|
|
5
|
-
|
|
6
|
-
from .test_graph import BaseAttrGraphTester, BaseGraphTester
|
|
7
|
-
from .test_graph import TestEdgeSubgraph as _TestGraphEdgeSubgraph
|
|
8
|
-
from .test_graph import TestGraph as _TestGraph
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class BaseDiGraphTester(BaseGraphTester):
|
|
12
|
-
def test_has_successor(self):
|
|
13
|
-
G = self.K3
|
|
14
|
-
assert G.has_successor(0, 1)
|
|
15
|
-
assert not G.has_successor(0, -1)
|
|
16
|
-
|
|
17
|
-
def test_successors(self):
|
|
18
|
-
G = self.K3
|
|
19
|
-
assert sorted(G.successors(0)) == [1, 2]
|
|
20
|
-
with pytest.raises(nx.NetworkXError):
|
|
21
|
-
G.successors(-1)
|
|
22
|
-
|
|
23
|
-
def test_has_predecessor(self):
|
|
24
|
-
G = self.K3
|
|
25
|
-
assert G.has_predecessor(0, 1)
|
|
26
|
-
assert not G.has_predecessor(0, -1)
|
|
27
|
-
|
|
28
|
-
def test_predecessors(self):
|
|
29
|
-
G = self.K3
|
|
30
|
-
assert sorted(G.predecessors(0)) == [1, 2]
|
|
31
|
-
with pytest.raises(nx.NetworkXError):
|
|
32
|
-
G.predecessors(-1)
|
|
33
|
-
|
|
34
|
-
def test_edges(self):
|
|
35
|
-
G = self.K3
|
|
36
|
-
assert sorted(G.edges()) == [(0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1)]
|
|
37
|
-
assert sorted(G.edges(0)) == [(0, 1), (0, 2)]
|
|
38
|
-
assert sorted(G.edges([0, 1])) == [(0, 1), (0, 2), (1, 0), (1, 2)]
|
|
39
|
-
with pytest.raises(nx.NetworkXError):
|
|
40
|
-
G.edges(-1)
|
|
41
|
-
|
|
42
|
-
def test_out_edges(self):
|
|
43
|
-
G = self.K3
|
|
44
|
-
assert sorted(G.out_edges()) == [(0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1)]
|
|
45
|
-
assert sorted(G.out_edges(0)) == [(0, 1), (0, 2)]
|
|
46
|
-
with pytest.raises(nx.NetworkXError):
|
|
47
|
-
G.out_edges(-1)
|
|
48
|
-
|
|
49
|
-
def test_out_edges_dir(self):
|
|
50
|
-
G = self.P3
|
|
51
|
-
assert sorted(G.out_edges()) == [(0, 1), (1, 2)]
|
|
52
|
-
assert sorted(G.out_edges(0)) == [(0, 1)]
|
|
53
|
-
assert sorted(G.out_edges(2)) == []
|
|
54
|
-
|
|
55
|
-
def test_out_edges_data(self):
|
|
56
|
-
G = nx.DiGraph([(0, 1, {"data": 0}), (1, 0, {})])
|
|
57
|
-
assert sorted(G.out_edges(data=True)) == [(0, 1, {"data": 0}), (1, 0, {})]
|
|
58
|
-
assert sorted(G.out_edges(0, data=True)) == [(0, 1, {"data": 0})]
|
|
59
|
-
assert sorted(G.out_edges(data="data")) == [(0, 1, 0), (1, 0, None)]
|
|
60
|
-
assert sorted(G.out_edges(0, data="data")) == [(0, 1, 0)]
|
|
61
|
-
|
|
62
|
-
def test_in_edges_dir(self):
|
|
63
|
-
G = self.P3
|
|
64
|
-
assert sorted(G.in_edges()) == [(0, 1), (1, 2)]
|
|
65
|
-
assert sorted(G.in_edges(0)) == []
|
|
66
|
-
assert sorted(G.in_edges(2)) == [(1, 2)]
|
|
67
|
-
|
|
68
|
-
def test_in_edges_data(self):
|
|
69
|
-
G = nx.DiGraph([(0, 1, {"data": 0}), (1, 0, {})])
|
|
70
|
-
assert sorted(G.in_edges(data=True)) == [(0, 1, {"data": 0}), (1, 0, {})]
|
|
71
|
-
assert sorted(G.in_edges(1, data=True)) == [(0, 1, {"data": 0})]
|
|
72
|
-
assert sorted(G.in_edges(data="data")) == [(0, 1, 0), (1, 0, None)]
|
|
73
|
-
assert sorted(G.in_edges(1, data="data")) == [(0, 1, 0)]
|
|
74
|
-
|
|
75
|
-
def test_degree(self):
|
|
76
|
-
G = self.K3
|
|
77
|
-
assert sorted(G.degree()) == [(0, 4), (1, 4), (2, 4)]
|
|
78
|
-
assert dict(G.degree()) == {0: 4, 1: 4, 2: 4}
|
|
79
|
-
assert G.degree(0) == 4
|
|
80
|
-
assert list(G.degree(iter([0]))) == [(0, 4)] # run through iterator
|
|
81
|
-
|
|
82
|
-
def test_in_degree(self):
|
|
83
|
-
G = self.K3
|
|
84
|
-
assert sorted(G.in_degree()) == [(0, 2), (1, 2), (2, 2)]
|
|
85
|
-
assert dict(G.in_degree()) == {0: 2, 1: 2, 2: 2}
|
|
86
|
-
assert G.in_degree(0) == 2
|
|
87
|
-
assert list(G.in_degree(iter([0]))) == [(0, 2)] # run through iterator
|
|
88
|
-
|
|
89
|
-
def test_out_degree(self):
|
|
90
|
-
G = self.K3
|
|
91
|
-
assert sorted(G.out_degree()) == [(0, 2), (1, 2), (2, 2)]
|
|
92
|
-
assert dict(G.out_degree()) == {0: 2, 1: 2, 2: 2}
|
|
93
|
-
assert G.out_degree(0) == 2
|
|
94
|
-
assert list(G.out_degree(iter([0]))) == [(0, 2)]
|
|
95
|
-
|
|
96
|
-
def test_size(self):
|
|
97
|
-
G = self.K3
|
|
98
|
-
assert G.size() == 6
|
|
99
|
-
assert G.number_of_edges() == 6
|
|
100
|
-
|
|
101
|
-
def test_to_undirected_reciprocal(self):
|
|
102
|
-
G = self.Graph()
|
|
103
|
-
G.add_edge(1, 2)
|
|
104
|
-
assert G.to_undirected().has_edge(1, 2)
|
|
105
|
-
assert not G.to_undirected(reciprocal=True).has_edge(1, 2)
|
|
106
|
-
G.add_edge(2, 1)
|
|
107
|
-
assert G.to_undirected(reciprocal=True).has_edge(1, 2)
|
|
108
|
-
|
|
109
|
-
def test_reverse_copy(self):
|
|
110
|
-
G = nx.DiGraph([(0, 1), (1, 2)])
|
|
111
|
-
R = G.reverse()
|
|
112
|
-
assert sorted(R.edges()) == [(1, 0), (2, 1)]
|
|
113
|
-
R.remove_edge(1, 0)
|
|
114
|
-
assert sorted(R.edges()) == [(2, 1)]
|
|
115
|
-
assert sorted(G.edges()) == [(0, 1), (1, 2)]
|
|
116
|
-
|
|
117
|
-
def test_reverse_nocopy(self):
|
|
118
|
-
G = nx.DiGraph([(0, 1), (1, 2)])
|
|
119
|
-
R = G.reverse(copy=False)
|
|
120
|
-
assert sorted(R.edges()) == [(1, 0), (2, 1)]
|
|
121
|
-
with pytest.raises(nx.NetworkXError):
|
|
122
|
-
R.remove_edge(1, 0)
|
|
123
|
-
|
|
124
|
-
def test_reverse_hashable(self):
|
|
125
|
-
class Foo:
|
|
126
|
-
pass
|
|
127
|
-
|
|
128
|
-
x = Foo()
|
|
129
|
-
y = Foo()
|
|
130
|
-
G = nx.DiGraph()
|
|
131
|
-
G.add_edge(x, y)
|
|
132
|
-
assert nodes_equal(G.nodes(), G.reverse().nodes())
|
|
133
|
-
assert [(y, x)] == list(G.reverse().edges())
|
|
134
|
-
|
|
135
|
-
def test_di_cache_reset(self):
|
|
136
|
-
G = self.K3.copy()
|
|
137
|
-
old_succ = G.succ
|
|
138
|
-
assert id(G.succ) == id(old_succ)
|
|
139
|
-
old_adj = G.adj
|
|
140
|
-
assert id(G.adj) == id(old_adj)
|
|
141
|
-
|
|
142
|
-
G._succ = {}
|
|
143
|
-
assert id(G.succ) != id(old_succ)
|
|
144
|
-
assert id(G.adj) != id(old_adj)
|
|
145
|
-
|
|
146
|
-
old_pred = G.pred
|
|
147
|
-
assert id(G.pred) == id(old_pred)
|
|
148
|
-
G._pred = {}
|
|
149
|
-
assert id(G.pred) != id(old_pred)
|
|
150
|
-
|
|
151
|
-
def test_di_attributes_cached(self):
|
|
152
|
-
G = self.K3.copy()
|
|
153
|
-
assert id(G.in_edges) == id(G.in_edges)
|
|
154
|
-
assert id(G.out_edges) == id(G.out_edges)
|
|
155
|
-
assert id(G.in_degree) == id(G.in_degree)
|
|
156
|
-
assert id(G.out_degree) == id(G.out_degree)
|
|
157
|
-
assert id(G.succ) == id(G.succ)
|
|
158
|
-
assert id(G.pred) == id(G.pred)
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
class BaseAttrDiGraphTester(BaseDiGraphTester, BaseAttrGraphTester):
|
|
162
|
-
def test_edges_data(self):
|
|
163
|
-
G = self.K3
|
|
164
|
-
all_edges = [
|
|
165
|
-
(0, 1, {}),
|
|
166
|
-
(0, 2, {}),
|
|
167
|
-
(1, 0, {}),
|
|
168
|
-
(1, 2, {}),
|
|
169
|
-
(2, 0, {}),
|
|
170
|
-
(2, 1, {}),
|
|
171
|
-
]
|
|
172
|
-
assert sorted(G.edges(data=True)) == all_edges
|
|
173
|
-
assert sorted(G.edges(0, data=True)) == all_edges[:2]
|
|
174
|
-
assert sorted(G.edges([0, 1], data=True)) == all_edges[:4]
|
|
175
|
-
with pytest.raises(nx.NetworkXError):
|
|
176
|
-
G.edges(-1, True)
|
|
177
|
-
|
|
178
|
-
def test_in_degree_weighted(self):
|
|
179
|
-
G = self.K3.copy()
|
|
180
|
-
G.add_edge(0, 1, weight=0.3, other=1.2)
|
|
181
|
-
assert sorted(G.in_degree(weight="weight")) == [(0, 2), (1, 1.3), (2, 2)]
|
|
182
|
-
assert dict(G.in_degree(weight="weight")) == {0: 2, 1: 1.3, 2: 2}
|
|
183
|
-
assert G.in_degree(1, weight="weight") == 1.3
|
|
184
|
-
assert sorted(G.in_degree(weight="other")) == [(0, 2), (1, 2.2), (2, 2)]
|
|
185
|
-
assert dict(G.in_degree(weight="other")) == {0: 2, 1: 2.2, 2: 2}
|
|
186
|
-
assert G.in_degree(1, weight="other") == 2.2
|
|
187
|
-
assert list(G.in_degree(iter([1]), weight="other")) == [(1, 2.2)]
|
|
188
|
-
|
|
189
|
-
def test_out_degree_weighted(self):
|
|
190
|
-
G = self.K3.copy()
|
|
191
|
-
G.add_edge(0, 1, weight=0.3, other=1.2)
|
|
192
|
-
assert sorted(G.out_degree(weight="weight")) == [(0, 1.3), (1, 2), (2, 2)]
|
|
193
|
-
assert dict(G.out_degree(weight="weight")) == {0: 1.3, 1: 2, 2: 2}
|
|
194
|
-
assert G.out_degree(0, weight="weight") == 1.3
|
|
195
|
-
assert sorted(G.out_degree(weight="other")) == [(0, 2.2), (1, 2), (2, 2)]
|
|
196
|
-
assert dict(G.out_degree(weight="other")) == {0: 2.2, 1: 2, 2: 2}
|
|
197
|
-
assert G.out_degree(0, weight="other") == 2.2
|
|
198
|
-
assert list(G.out_degree(iter([0]), weight="other")) == [(0, 2.2)]
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
class TestDiGraph(BaseAttrDiGraphTester, _TestGraph):
|
|
202
|
-
"""Tests specific to dict-of-dict-of-dict digraph data structure"""
|
|
203
|
-
|
|
204
|
-
def setup_method(self):
|
|
205
|
-
self.Graph = nx.DiGraph
|
|
206
|
-
# build dict-of-dict-of-dict K3
|
|
207
|
-
ed1, ed2, ed3, ed4, ed5, ed6 = ({}, {}, {}, {}, {}, {})
|
|
208
|
-
self.k3adj = {0: {1: ed1, 2: ed2}, 1: {0: ed3, 2: ed4}, 2: {0: ed5, 1: ed6}}
|
|
209
|
-
self.k3edges = [(0, 1), (0, 2), (1, 2)]
|
|
210
|
-
self.k3nodes = [0, 1, 2]
|
|
211
|
-
self.K3 = self.Graph()
|
|
212
|
-
self.K3._succ = self.k3adj # K3._adj is synced with K3._succ
|
|
213
|
-
self.K3._pred = {0: {1: ed3, 2: ed5}, 1: {0: ed1, 2: ed6}, 2: {0: ed2, 1: ed4}}
|
|
214
|
-
self.K3._node = {}
|
|
215
|
-
self.K3._node[0] = {}
|
|
216
|
-
self.K3._node[1] = {}
|
|
217
|
-
self.K3._node[2] = {}
|
|
218
|
-
|
|
219
|
-
ed1, ed2 = ({}, {})
|
|
220
|
-
self.P3 = self.Graph()
|
|
221
|
-
self.P3._succ = {0: {1: ed1}, 1: {2: ed2}, 2: {}}
|
|
222
|
-
self.P3._pred = {0: {}, 1: {0: ed1}, 2: {1: ed2}}
|
|
223
|
-
# P3._adj is synced with P3._succ
|
|
224
|
-
self.P3._node = {}
|
|
225
|
-
self.P3._node[0] = {}
|
|
226
|
-
self.P3._node[1] = {}
|
|
227
|
-
self.P3._node[2] = {}
|
|
228
|
-
|
|
229
|
-
def test_data_input(self):
|
|
230
|
-
G = self.Graph({1: [2], 2: [1]}, name="test")
|
|
231
|
-
assert G.name == "test"
|
|
232
|
-
assert sorted(G.adj.items()) == [(1, {2: {}}), (2, {1: {}})]
|
|
233
|
-
assert sorted(G.succ.items()) == [(1, {2: {}}), (2, {1: {}})]
|
|
234
|
-
assert sorted(G.pred.items()) == [(1, {2: {}}), (2, {1: {}})]
|
|
235
|
-
|
|
236
|
-
def test_add_edge(self):
|
|
237
|
-
G = self.Graph()
|
|
238
|
-
G.add_edge(0, 1)
|
|
239
|
-
assert G.adj == {0: {1: {}}, 1: {}}
|
|
240
|
-
assert G.succ == {0: {1: {}}, 1: {}}
|
|
241
|
-
assert G.pred == {0: {}, 1: {0: {}}}
|
|
242
|
-
G = self.Graph()
|
|
243
|
-
G.add_edge(*(0, 1))
|
|
244
|
-
assert G.adj == {0: {1: {}}, 1: {}}
|
|
245
|
-
assert G.succ == {0: {1: {}}, 1: {}}
|
|
246
|
-
assert G.pred == {0: {}, 1: {0: {}}}
|
|
247
|
-
with pytest.raises(ValueError, match="None cannot be a node"):
|
|
248
|
-
G.add_edge(None, 3)
|
|
249
|
-
|
|
250
|
-
def test_add_edges_from(self):
|
|
251
|
-
G = self.Graph()
|
|
252
|
-
G.add_edges_from([(0, 1), (0, 2, {"data": 3})], data=2)
|
|
253
|
-
assert G.adj == {0: {1: {"data": 2}, 2: {"data": 3}}, 1: {}, 2: {}}
|
|
254
|
-
assert G.succ == {0: {1: {"data": 2}, 2: {"data": 3}}, 1: {}, 2: {}}
|
|
255
|
-
assert G.pred == {0: {}, 1: {0: {"data": 2}}, 2: {0: {"data": 3}}}
|
|
256
|
-
|
|
257
|
-
with pytest.raises(nx.NetworkXError):
|
|
258
|
-
G.add_edges_from([(0,)]) # too few in tuple
|
|
259
|
-
with pytest.raises(nx.NetworkXError):
|
|
260
|
-
G.add_edges_from([(0, 1, 2, 3)]) # too many in tuple
|
|
261
|
-
with pytest.raises(TypeError):
|
|
262
|
-
G.add_edges_from([0]) # not a tuple
|
|
263
|
-
with pytest.raises(ValueError, match="None cannot be a node"):
|
|
264
|
-
G.add_edges_from([(None, 3), (3, 2)])
|
|
265
|
-
|
|
266
|
-
def test_remove_edge(self):
|
|
267
|
-
G = self.K3.copy()
|
|
268
|
-
G.remove_edge(0, 1)
|
|
269
|
-
assert G.succ == {0: {2: {}}, 1: {0: {}, 2: {}}, 2: {0: {}, 1: {}}}
|
|
270
|
-
assert G.pred == {0: {1: {}, 2: {}}, 1: {2: {}}, 2: {0: {}, 1: {}}}
|
|
271
|
-
with pytest.raises(nx.NetworkXError):
|
|
272
|
-
G.remove_edge(-1, 0)
|
|
273
|
-
|
|
274
|
-
def test_remove_edges_from(self):
|
|
275
|
-
G = self.K3.copy()
|
|
276
|
-
G.remove_edges_from([(0, 1)])
|
|
277
|
-
assert G.succ == {0: {2: {}}, 1: {0: {}, 2: {}}, 2: {0: {}, 1: {}}}
|
|
278
|
-
assert G.pred == {0: {1: {}, 2: {}}, 1: {2: {}}, 2: {0: {}, 1: {}}}
|
|
279
|
-
G.remove_edges_from([(0, 0)]) # silent fail
|
|
280
|
-
|
|
281
|
-
def test_clear(self):
|
|
282
|
-
G = self.K3
|
|
283
|
-
G.graph["name"] = "K3"
|
|
284
|
-
G.clear()
|
|
285
|
-
assert list(G.nodes) == []
|
|
286
|
-
assert G.succ == {}
|
|
287
|
-
assert G.pred == {}
|
|
288
|
-
assert G.graph == {}
|
|
289
|
-
|
|
290
|
-
def test_clear_edges(self):
|
|
291
|
-
G = self.K3
|
|
292
|
-
G.graph["name"] = "K3"
|
|
293
|
-
nodes = list(G.nodes)
|
|
294
|
-
G.clear_edges()
|
|
295
|
-
assert list(G.nodes) == nodes
|
|
296
|
-
expected = {0: {}, 1: {}, 2: {}}
|
|
297
|
-
assert G.succ == expected
|
|
298
|
-
assert G.pred == expected
|
|
299
|
-
assert list(G.edges) == []
|
|
300
|
-
assert G.graph["name"] == "K3"
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
class TestEdgeSubgraph(_TestGraphEdgeSubgraph):
|
|
304
|
-
"""Unit tests for the :meth:`DiGraph.edge_subgraph` method."""
|
|
305
|
-
|
|
306
|
-
def setup_method(self):
|
|
307
|
-
# Create a doubly-linked path graph on five nodes.
|
|
308
|
-
G = nx.DiGraph(nx.path_graph(5))
|
|
309
|
-
# Add some node, edge, and graph attributes.
|
|
310
|
-
for i in range(5):
|
|
311
|
-
G.nodes[i]["name"] = f"node{i}"
|
|
312
|
-
G.edges[0, 1]["name"] = "edge01"
|
|
313
|
-
G.edges[3, 4]["name"] = "edge34"
|
|
314
|
-
G.graph["name"] = "graph"
|
|
315
|
-
# Get the subgraph induced by the first and last edges.
|
|
316
|
-
self.G = G
|
|
317
|
-
self.H = G.edge_subgraph([(0, 1), (3, 4)])
|
|
318
|
-
|
|
319
|
-
def test_pred_succ(self):
|
|
320
|
-
"""Test that nodes are added to predecessors and successors.
|
|
321
|
-
|
|
322
|
-
For more information, see GitHub issue #2370.
|
|
323
|
-
|
|
324
|
-
"""
|
|
325
|
-
G = nx.DiGraph()
|
|
326
|
-
G.add_edge(0, 1)
|
|
327
|
-
H = G.edge_subgraph([(0, 1)])
|
|
328
|
-
assert list(H.predecessors(0)) == []
|
|
329
|
-
assert list(H.successors(0)) == [1]
|
|
330
|
-
assert list(H.predecessors(1)) == [0]
|
|
331
|
-
assert list(H.successors(1)) == []
|