Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark test as random to avoid failure #39377

Merged
merged 2 commits into from
Jan 27, 2025

Conversation

user202729
Copy link
Contributor

Fix issue pointed out in #39153 (comment)

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

Copy link

github-actions bot commented Jan 25, 2025

Documentation preview for this PR (built with commit e75bf95; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@orlitzky
Copy link
Contributor

I think the point of the test (going back to #252) is that the number field is created successfully, so why not...

sage: K
Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2

Otherwise we are only wasting a few milliseconds generating output that isn't checked and isn't very instructive.

@user202729
Copy link
Contributor Author

@orlitzky actually the following line is checked

sorted([F.discriminant() for F, _, _ in l])

it checks the sorted numerical values of the discriminants (if you want to be extra careful we can also check the degree, but I think this is enough)

@orlitzky
Copy link
Contributor

@orlitzky actually the following line is checked

That part is fine. It's,

        sage: l  # random (see :issue:`39153`)                                                                                          
            [(Number Field in a0 with defining polynomial x,                                                                                                   
              Ring morphism:                                                                                                                                   
                From: Number Field in a0 with defining polynomial x                                                                                            
                To:   Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2                                                                           
                Defn: 0 |--> 0,                                                                                                                                
              None),                                                                                                                                           
             (Number Field in a1 with defining polynomial x^2 - 2,                                                                                             
              Ring morphism:                                                                                                                                   
                From: Number Field in a1 with defining polynomial x^2 - 2                                                                                      
                To:   Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2                                                                           
                Defn: a1 |--> a^2 + 3/2,                                                                                                                       
              None),                                                                                                                                           
             (Number Field in a2 with defining polynomial x^2 + 4,                                                                                             
              Ring morphism:                                                                                                                                   
                From: Number Field in a2 with defining polynomial x^2 + 4                                                                                      
                To:   Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2                                                                           
                Defn: a2 |--> 2*a^3 + 7*a,                                                                                                                     
              None),                                                                                                                                           
             (Number Field in a3 with defining polynomial x^2 + 2,                                                                                             
              Ring morphism:                                                                                                                                   
                From: Number Field in a3 with defining polynomial x^2 + 2                                                                                      
                To:   Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2                                                                           
                Defn: a3 |--> 2*a^3 + 5*a,                                                                                                                     
              None),                                                                                                                                           
             (Number Field in a4 with defining polynomial x^4 + 1,                                                                                             
              Ring morphism:                                                                                                                                   
                From: Number Field in a4 with defining polynomial x^4 + 1                                                                                      
                To:   Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2                                                                           
                Defn: a4 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4,                                                                                                     
              Ring morphism:                                                                                                                                   
                From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2                                                                           
                To:   Number Field in a4 with defining polynomial x^4 + 1                                                                                      
                Defn: a |--> -1/2*a4^3 + a4^2 - 1/2*a4)]

that I think is taking up a lot of space for no benefit. Sometimes you have to print a random number to show how a method works, but here, displaying a bunch of semi-random output isn't really helping to explain (or test) anything.

@orlitzky
Copy link
Contributor

(Instead of printing the subfields, I was suggesting printing K, and then you can still do sorted([F.discriminant() for F, _, _ in K.subfields()]).

@orlitzky
Copy link
Contributor

And actually, this is a TESTS block, so it isn't even included in the documentation...

@orlitzky
Copy link
Contributor

Cool, thanks. I have faith that CI will pass.

@vbraun vbraun merged commit efc0914 into sagemath:develop Jan 27, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants