Skip to content

Commit 3cd9ba7

Browse files
committed
sage.rings.padics.padic_lattice_element_test: improve readability
Move the padic imports and FutureWarning filter to the top level, so we don't have to repeat them four times.
1 parent 1d9794e commit 3cd9ba7

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

src/sage/rings/padics/padic_lattice_element_test.py

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,29 @@
11
import pytest
2+
from sage.rings.padics.factory import ZpLC, ZpLF, QpLC, QpLF
3+
4+
# ZpLC, ZpLF, QpLC, and QpLF all raise FutureWarnings
5+
from warnings import catch_warnings, filterwarnings
6+
filterwarnings("ignore", category=FutureWarning)
27

38

49
@pytest.fixture
510
def R1():
6-
from warnings import catch_warnings, filterwarnings
7-
from sage.rings.padics.factory import ZpLC
8-
with catch_warnings(category=FutureWarning):
9-
filterwarnings("ignore", category=FutureWarning)
10-
return ZpLC(2)
11+
return ZpLC(2)
1112

1213

1314
@pytest.fixture
1415
def R2():
15-
from warnings import catch_warnings, filterwarnings
16-
from sage.rings.padics.factory import ZpLF
17-
with catch_warnings(category=FutureWarning):
18-
filterwarnings("ignore", category=FutureWarning)
19-
return ZpLF(2)
16+
return ZpLF(2)
2017

2118

2219
@pytest.fixture
2320
def R3():
24-
from warnings import catch_warnings, filterwarnings
25-
from sage.rings.padics.factory import QpLC
26-
with catch_warnings(category=FutureWarning):
27-
filterwarnings("ignore", category=FutureWarning)
28-
return QpLC(2)
21+
return QpLC(2)
2922

3023

3124
@pytest.fixture
3225
def R4():
33-
from warnings import catch_warnings, filterwarnings
34-
from sage.rings.padics.factory import QpLF
35-
with catch_warnings(category=FutureWarning):
36-
filterwarnings("ignore", category=FutureWarning)
37-
return QpLF(2)
26+
return QpLF(2)
3827

3928

4029
# Use strings for the fixture names here, and then later convert them

0 commit comments

Comments
 (0)