Opened 3 years ago

Closed 3 years ago

# doctesting mangles long lines

Reported by: Owned by: dimpase major sage-duplicate/invalid/wontfix interfaces N/A

### Description

while working on #26856, we observed

```File "src/sage/algebras/quantum_groups/quantum_group_gap.py", line 757, in sage.algebras.quantum_groups.quantum_group_gap.QuantumGroup.coproduct
Failed example:
[Q.coproduct(f, 2) for f in Q.F_simple()]  # optional - gap_packages
Expected:
[1*(1<x>1<x>F[a1]) + -q^2 + q^-2*(1<x>F[a1]<x>[ K1 ; 1 ])
+ 1*(1<x>F[a1]<x>K1) + q^4-2 + q^-4*(F[a1]<x>[ K1 ; 1 ]<x>[ K1 ; 1 ])
+ -q^2 + q^-2*(F[a1]<x>[ K1 ; 1 ]<x>K1) + -q^2
+ q^-2*(F[a1]<x>K1<x>[ K1 ; 1 ]) + 1*(F[a1]<x>K1<x>K1),
1*(1<x>1<x>F[a2]) + -q + q^-1*(1<x>F[a2]<x>[ K2 ; 1 ])
+ 1*(1<x>F[a2]<x>K2) + q^2-2 + q^-2*(F[a2]<x>[ K2 ; 1 ]<x>[ K2 ; 1 ])
+ -q + q^-1*(F[a2]<x>[ K2 ; 1 ]<x>K2) + -q
+ q^-1*(F[a2]<x>K2<x>[ K2 ; 1 ]) + 1*(F[a2]<x>K2<x>K2)]
Got:
[1*(1<x>1<x>F[a1]) + -q^2 + q^-2*(1<x>F[a1]<x>[ K1 ; 1 ]) + 1*(1<x>F[a1]<x>K1) + q^4-2 + q^-4*(F
1<x>[ K1 ; 1 ]<x>[ K1 ; 1 ]) + -q^2 + q^-2*(F[a1]<x>[ K1 ; 1 ]<x>K1) + -q^2 + q^-2*(F
1<x>K1<x>[ K1 ; 1 ]) + 1*(F[a1]<x>K1<x>K1),
1*(1<x>1<x>F[a2]) + -q + q^-1*(1<x>F[a2]<x>[ K2 ; 1 ]) + 1*(1<x>F[a2]<x>K2) + q^2-2 + q^-2*(F
4<x>[ K2 ; 1 ]<x>[ K2 ; 1 ]) + -q + q^-1*(F[a2]<x>[ K2 ; 1 ]<x>K2) + -q + q^-1*(F[a2]<x>K
2<x>[ K2 ; 1 ]) + 1*(F[a2]<x>K2<x>K2)]
```

so some patters such as `F[a1]` get mangled.

See comment 40 on #26856 on how it looks if the output is LaTeXified, one sees `\n` getting in.

### comment:1 Changed 3 years ago by embray

I have my doubts about this, but it's not inconceivable. Like you said, it's such a noisy line I wonder if there are some false positives, e.g. from some of the doctest fixups for Python 2/3 compatibility, or something along those lines. I'll look into it.

### comment:2 Changed 3 years ago by embray

This was fixed in #26856, specifically by d0b769d6. The problem was not in the doctest framework per se, but rather with how print representations of GAP objects were being captured, with GAP's automatic line breaking in effect.

We haven't fixed the problem 100%, because GAP may still insert unwanted line breaks in extreme cases where a line of output is > 4096 bytes. A better solution would be to have a flag (I think `--norepl` should do this) to disable GAP's automatic line breaking entirely. But that's a fix needed upstream.

### comment:3 Changed 3 years ago by embray

• Component changed from doctest framework to interfaces
• Milestone changed from sage-8.6 to sage-duplicate/invalid/wontfix
• Resolution set to worksforme
• Status changed from new to closed
Note: See TracTickets for help on using tickets.