@@ -2885,35 +2885,38 @@ def quick_poly():
28852885
28862886 ctx1 = get_context (("x" , 4 ))
28872887 ctx2 = get_context (("x" , 4 ), ordering = "deglex" )
2888- assert ctx1 .drop_gens (* ctx1 .names ()).names () == tuple ()
2889- assert ctx1 .drop_gens (ctx1 .name (1 ), ctx1 .name (2 )).names () == (ctx1 .name (0 ), ctx1 .name (3 ))
2890- assert ctx1 .drop_gens ().names () == ctx1 .names ()
2891- assert ctx1 .drop_gens (- 1 ).names () == ctx1 .names ()[:- 1 ]
2888+ assert ctx1 .drop_gens (ctx1 .names ()).names () == tuple ()
2889+ assert ctx1 .drop_gens (( ctx1 .name (1 ), ctx1 .name (2 ) )).names () == (ctx1 .name (0 ), ctx1 .name (3 ))
2890+ assert ctx1 .drop_gens (tuple () ).names () == ctx1 .names ()
2891+ assert ctx1 .drop_gens (( - 1 ,) ).names () == ctx1 .names ()[:- 1 ]
28922892
28932893 assert ctx .infer_generator_mapping (ctx ) == {i : i for i in range (ctx .nvars ())}
28942894 assert ctx1 .infer_generator_mapping (ctx ) == {0 : 0 , 1 : 1 }
2895- assert ctx1 .drop_gens (* ctx .names ()).infer_generator_mapping (ctx ) == {}
2895+ assert ctx1 .drop_gens (ctx .names ()).infer_generator_mapping (ctx ) == {}
28962896
28972897 # FIXME: Remove this guard when https://github.com/flintlib/flint/pull/2068 is
28982898 # resolved
28992899 if P is not flint .fmpz_mod_mpoly :
2900- assert quick_poly ().coerce_to_context (ctx1 ) == \
2900+ assert quick_poly ().project_to_context (ctx1 ) == \
29012901 ctx1 .from_dict (
29022902 {(0 , 0 , 0 , 0 ): 1 , (0 , 1 , 0 , 0 ): 2 , (1 , 0 , 0 , 0 ): 3 , (2 , 2 , 0 , 0 ): 4 }
29032903 )
2904- assert quick_poly ().coerce_to_context (ctx1 ).drop_unused_gens () == (ctx , quick_poly ())
2904+ new_poly = quick_poly ().project_to_context (ctx1 )
2905+ assert ctx1 .drop_gens (new_poly .unused_gens ()) == ctx
2906+ assert new_poly .project_to_context (ctx ) == quick_poly ()
29052907
2906- new_ctx , new_poly = quick_poly ().coerce_to_context (ctx2 ).drop_unused_gens ()
2908+ new_poly = quick_poly ().project_to_context (ctx2 )
2909+ new_ctx = ctx2 .drop_gens (new_poly .unused_gens ())
29072910 assert new_ctx != ctx
29082911 assert new_poly != quick_poly ()
29092912
29102913 new_ctx = new_ctx .from_context (new_ctx , ordering = ctx .ordering ())
29112914 assert new_ctx == ctx
2912- assert new_poly .coerce_to_context (new_ctx ) == quick_poly ()
2915+ assert new_poly .project_to_context (new_ctx ) == quick_poly ()
29132916
29142917 assert ctx .append_gens (* ctx1 .names ()[- 2 :]) == ctx1
29152918 else :
2916- assert raises (lambda : quick_poly ().coerce_to_context (ctx1 ), NotImplementedError )
2919+ assert raises (lambda : quick_poly ().project_to_context (ctx1 ), NotImplementedError )
29172920
29182921 assert P (val = {(0 , 0 ): 1 }, ctx = ctx ) == ctx .from_dict ({(0 , 0 ): 1 })
29192922 assert P (ctx = ctx ).context () == ctx
0 commit comments