Opened 4 years ago

Closed 4 years ago

#23618 closed defect (duplicate)

Occurrence of sets in doctests

Reported by: mderickx Owned by:
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: doctest coverage Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

At https://patchbot.sagemath.org/log/23613/Ubuntu/14.04/i686/3.13.0-95-generic/arando/2017-08-13%2023:08:11?short there is a doctest that fails simply because the output order of the elements in the set changed. It is bad to have sets as output in doctests without the # random since the order of the output is not well defined. Below are a bunch of tests that should be rewritten to have more stable and hence meaningful doctest results.

bt-nac-c158:sagedev mderickx$ grep -r "sage: set(" ./src/sage | grep -v "=="
./src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx:            sage: set([x*y*z, z*y+x*z,x*y*z])  # indirect doctest
./src/sage/combinat/designs/bibd.py:            sage: set(len(sa2.intersection(b)) for b in B.blocks())
./src/sage/combinat/designs/bibd.py:            sage: set(b.arc()).issubset(b.ground_set())
./src/sage/combinat/designs/block_design.py:        sage: set(b_0_1).intersection(b_57_70)
./src/sage/combinat/designs/block_design.py:        sage: set(b_1_10).intersection(b_70_59)
./src/sage/combinat/designs/block_design.py:        sage: set(b_10_0).intersection(b_59_57)
./src/sage/crypto/boolean_function.pyx:            sage: set([ fi*g(i) for i,fi in enumerate(f) ])
./src/sage/data_structures/bitset.pyx:            sage: set(FrozenBitset('11011'))
./src/sage/data_structures/bitset.pyx:            sage: set(a)
./src/sage/geometry/polyhedron/backend_normaliz.py:            sage: set(p.Hrepresentation())                                 # optional - pynormaliz
./src/sage/geometry/polyhedron/backend_normaliz.py:            sage: set(p.Vrepresentation())                                 # optional - pynormaliz
./src/sage/geometry/polyhedron/backend_normaliz.py:            sage: set(p.Hrepresentation())                                 # optional - pynormaliz
./src/sage/geometry/polyhedron/backend_normaliz.py:            sage: set(p.Vrepresentation())                                 # optional - pynormaliz
./src/sage/geometry/polyhedron/backend_normaliz.py:            sage: set(PI.Vrepresentation())                                # optional - pynormaliz
./src/sage/geometry/polyhedron/backend_normaliz.py:            sage: set(PI.Vrepresentation())                                # optional - pynormaliz
./src/sage/geometry/polyhedron/backend_polymake.py:            sage: set(p.Hrepresentation())                                 # optional - polymake
./src/sage/geometry/polyhedron/backend_polymake.py:            sage: set(p.Vrepresentation())                                 # optional - polymake
./src/sage/geometry/polyhedron/backend_polymake.py:            sage: set(p.Hrepresentation())                                 # optional - polymake
./src/sage/geometry/polyhedron/backend_polymake.py:            sage: set(p.Vrepresentation())                                 # optional - polymake
./src/sage/graphs/generators/families.py:        sage: set([g.laplacian_matrix(normalized=True).charpoly() for g in g_list])  # long time (7s on sage.math, 2011)
./src/sage/graphs/generators/smallgraphs.py:        sage: set([ len([x for x in G.neighbors(i) if x in G.neighbors(j)])
./src/sage/graphs/generic_graph.py:            sage: set(G.edge_labels())
./src/sage/graphs/graph_plot.py:            sage: set(map(type, flatten(gp._pos.values())))
./src/sage/graphs/graph_plot.py:            sage: set(map(type, flatten(gp._pos.values())))
Binary file ./src/sage/misc/sageinspect.pyc matches
./src/sage/numerical/backends/interactivelp_backend.pyx:            sage: set(d.basic_variables())
./src/sage/numerical/mip.pyx:            sage: set(basis2)
./src/sage/plot/colors.py:            sage: set([(type(c), type(cols[c])) for c in cols])
./src/sage/repl/display/pretty_print.py:            sage: set({1, 2, 3})
./src/sage/rings/finite_rings/finite_field_ext_pari.py:        sage: set(k)
./src/sage/rings/fraction_field_FpT.pyx:            sage: set([1, t, 1/t, t, t, 1/t, 1+1/t, t/t])
./src/sage/schemes/elliptic_curves/cm.py:        sage: set([hilbert_class_polynomial(D*f^2).degree() for D,f in v])
./src/sage/structure/coerce_dict.pyx:        sage: set(L.iteritems())
./src/sage/tests/french_book/mpoly.py:  sage: set(pt[zz].minpoly() for pt in V[:-1])

Change History (5)

comment:1 Changed 4 years ago by roed

I don't think # random is the right tag. Probably replacing the test with something like sorted(L, key=str) would be better.

comment:2 Changed 4 years ago by jdemeyer

This is essentially a duplicate of #23586

comment:3 Changed 4 years ago by mderickx

  • Milestone changed from sage-8.1 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

comment:4 Changed 4 years ago by mderickx

  • Status changed from needs_review to positive_review

I agree, this can be closed as duplicate

comment:5 Changed 4 years ago by mderickx

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.