Skip to content

Commit 0da76c7

Browse files
committed
Add tests for geometry/entity
1 parent 305c929 commit 0da76c7

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

sympy/geometry/tests/test_entity.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
from sympy import Symbol, Rational
22
from sympy.geometry import Circle, Ellipse, Line, Point, Polygon, Ray, RegularPolygon, Segment, Triangle
3-
from sympy.geometry.entity import scale
3+
from sympy.geometry.entity import scale, GeometryEntity
44
from sympy.testing.pytest import raises
55

66
from random import random
77

88

9+
def test_entity():
10+
x = Symbol('x', real=True)
11+
y = Symbol('y', real=True)
12+
13+
assert GeometryEntity(x, y) in GeometryEntity(x, y)
14+
raises(NotImplementedError, lambda: Point(0, 0) in GeometryEntity(x, y))
15+
16+
assert GeometryEntity(x, y) == GeometryEntity(x, y)
17+
assert GeometryEntity(x, y).equals(GeometryEntity(x, y))
18+
19+
c = Circle((0, 0), 5)
20+
assert GeometryEntity.encloses(c, Point(0, 0))
21+
assert GeometryEntity.encloses(c, Segment((0, 0), (1, 1)))
22+
assert GeometryEntity.encloses(c, Line((0, 0), (1, 1))) is False
23+
assert GeometryEntity.encloses(c, Circle((0, 0), 4))
24+
assert GeometryEntity.encloses(c, Polygon(Point(0, 0), Point(1, 0), Point(0, 1)))
25+
assert GeometryEntity.encloses(c, RegularPolygon(Point(8, 8), 1, 3)) is False
26+
27+
28+
929
def test_subs():
1030
x = Symbol('x', real=True)
1131
y = Symbol('y', real=True)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy