Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Added an extra message to _repr_ in case of an empty benchmark, encha…
Browse files Browse the repository at this point in the history
…nced docstring for _repr_
  • Loading branch information
David Lucas committed May 11, 2016
1 parent 18732e1 commit 536ed61
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/sage/coding/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,28 @@ def _repr_(self):
sage: Chan = channels.StaticErrorRateChannel(C.ambient_space(), D.decoding_radius())
sage: codes.Benchmark(C, D, Chan)
If ``self`` is an empty benchmark, a specific string representation
is given::
sage: codes.Benchmark()
Empty Benchmark object
If ``self`` is the result of an addition between several benchmarks,
a specific string representation is given::
sage: C1 = codes.GeneralizedReedSolomonCode(GF(59).list()[:40], 12)
sage: C2 = codes.GeneralizedReedSolomonCode(GF(59).list()[:40], 14)
sage: D1 = C1.decoder()
sage: D2 = C2.decoder()
sage: Chan1 = channels.StaticErrorRateChannel(C1.ambient_space(), D1.decoding_radius())
sage: Chan2 = channels.StaticErrorRateChannel(C2.ambient_space(), D2.decoding_radius())
sage: B1 = codes.Benchmark(C1, D1, Chan1)
sage: B2 = codes.Benchmark(C2, D2, Chan2)
sage: B1 + B2
Benchmarking structure consisting of 2 benchmark primitives
"""
if self.code() is None:
return "Empty Benchmark object"
l = len(self.identifier())
if l > 1:
return "Benchmarking structure consisting of %s benchmark primitives" % l
Expand Down

0 comments on commit 536ed61

Please sign in to comment.