Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Enable module doctests (#390)

Benjamin Hackl67a4ee6a070f
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d524cdf4b..591519858 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -130,3 +130,6 @@ jobs:
- name: Run tests
run: pytest
+
+ - name: Run module doctests
+ run: pytest --doctest-modules manim
\ No newline at end of file
diff --git a/manim/animation/__init__.py b/manim/animation/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/manim/camera/__init__.py b/manim/camera/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/manim/mobject/__init__.py b/manim/mobject/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.py
index 66f429263..5bd1ded62 100644
--- a/manim/mobject/mobject.py
+++ b/manim/mobject/mobject.py
@@ -107,6 +107,27 @@ class Mobject(Container):
--------
:meth:`~Mobject.remove`
+ Examples
+ --------
+ ::
+
+ >>> outer = Mobject()
+ >>> inner = Mobject()
+ >>> outer = outer.add(inner)
+
+ Duplicates are not added again::
+
+ >>> outer = outer.add(inner)
+ >>> len(outer.submobjects)
+ 1
+
+ Adding an object to itself raises an error::
+
+ >>> outer.add(outer)
+ Traceback (most recent call last):
+ ...
+ ValueError: Mobject cannot contain self
+
"""
if self in mobjects:
raise ValueError("Mobject cannot contain self")
diff --git a/manim/mobject/svg/__init__.py b/manim/mobject/svg/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/manim/mobject/types/__init__.py b/manim/mobject/types/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/manim/scene/__init__.py b/manim/scene/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/manim/utils/__init__.py b/manim/utils/__init__.py
new file mode 100644
index 000000000..e69de29bb