Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8747d14

Browse files
authored
Merge pull request #22512 from oscargus/coverage1
Increase coverage
2 parents fd83d95 + 673236c commit 8747d14

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

lib/matplotlib/tests/test_patches.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def test_Polygon_close():
3131

3232
# start with open path and close it:
3333
p = Polygon(xy, closed=True)
34+
assert p.get_closed()
3435
assert_array_equal(p.get_xy(), xyclosed)
3536
p.set_xy(xy)
3637
assert_array_equal(p.get_xy(), xyclosed)
@@ -43,6 +44,7 @@ def test_Polygon_close():
4344

4445
# start with open path and leave it open:
4546
p = Polygon(xy, closed=False)
47+
assert not p.get_closed()
4648
assert_array_equal(p.get_xy(), xy)
4749
p.set_xy(xy)
4850
assert_array_equal(p.get_xy(), xy)
@@ -723,6 +725,31 @@ def test_annulus_setters():
723725
ell.angle = 45
724726

725727

728+
@image_comparison(baseline_images=['annulus'], extensions=['png'])
729+
def test_annulus_setters2():
730+
731+
fig, ax = plt.subplots()
732+
cir = Annulus((0., 0.), 0.2, 0.01, fc='g') # circular annulus
733+
ell = Annulus((0., 0.), (1, 2), 0.1, 0, # elliptical
734+
fc='m', ec='b', alpha=0.5, hatch='xxx')
735+
ax.add_patch(cir)
736+
ax.add_patch(ell)
737+
ax.set_aspect('equal')
738+
739+
cir.center = (0.5, 0.5)
740+
cir.set_semimajor(0.2)
741+
cir.set_semiminor(0.2)
742+
assert cir.radii == (0.2, 0.2)
743+
cir.width = 0.05
744+
745+
ell.center = (0.5, 0.5)
746+
ell.set_semimajor(0.5)
747+
ell.set_semiminor(0.3)
748+
assert ell.radii == (0.5, 0.3)
749+
ell.width = 0.1
750+
ell.angle = 45
751+
752+
726753
def test_degenerate_polygon():
727754
point = [0, 0]
728755
correct_extents = Bbox([point, point]).extents

lib/matplotlib/tests/test_text.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,16 @@ def find_matplotlib_font(**kw):
4343
style="normal",
4444
variant="normal",
4545
size=14)
46-
ax.annotate(
46+
a = ax.annotate(
4747
"Normal Font",
4848
(0.1, 0.1),
4949
xycoords='axes fraction',
5050
fontproperties=normal_font)
51+
assert a.get_fontname() == 'DejaVu Sans'
52+
assert a.get_fontstyle() == 'normal'
53+
assert a.get_fontvariant() == 'normal'
54+
assert a.get_weight() == 'normal'
55+
assert a.get_stretch() == 'normal'
5156

5257
bold_font = find_matplotlib_font(
5358
family="Foo",

0 commit comments

Comments
 (0)