First, we use the nonnegative orthant in :math:`\mathbb{R}^{2}`:
->>> from dunshire import *
->>> K = NonnegativeOrthant(2)
->>> L = [[1,0],[0,1]]
->>> e1 = [1,1]
->>> e2 = e1
->>> G = SymmetricLinearGame(L,K,e1,e2)
->>> print(G.solution())
-Game value: 0.5000000
-Player 1 optimal:
- [0.5000000]
- [0.5000000]
-Player 2 optimal:
- [0.5000000]
- [0.5000000]
+.. doctest::
+
+ >>> from dunshire import *
+ >>> K = NonnegativeOrthant(2)
+ >>> L = [[1,0],[0,1]]
+ >>> e1 = [1,1]
+ >>> e2 = e1
+ >>> G = SymmetricLinearGame(L,K,e1,e2)
+ >>> print(G.solution())
+ Game value: 0.5000000
+ Player 1 optimal:
+ [0.5000000]
+ [0.5000000]
+ Player 2 optimal:
+ [0.5000000]
+ [0.5000000]
Next we try the Lorentz ice-cream cone in :math:`\mathbb{R}^{2}`:
->>> from dunshire import *
->>> K = IceCream(2)
->>> L = [[1,0],[0,1]]
->>> e1 = [1,1]
->>> e2 = e1
->>> G = SymmetricLinearGame(L,K,e1,e2)
->>> print(G.solution())
-Game value: 0.5000000
-Player 1 optimal:
- [0.5000000]
- [0.5000000]
-Player 2 optimal:
- [0.5000000]
- [0.5000000]
-
-(The answer when :math:`L`, :math:`e_{1}`, and :math:`e_{2}` are so
-simple is independent of the cone.)
+.. doctest::
+
+ >>> from dunshire import *
+ >>> K = IceCream(2)
+ >>> L = [[1,0],[0,1]]
+ >>> e1 = [1,1]
+ >>> e2 = e1
+ >>> G = SymmetricLinearGame(L,K,e1,e2)
+ >>> print(G.solution())
+ Game value: 0.5000000
+ Player 1 optimal:
+ [0.8347039]
+ [0.1652961]
+ Player 2 optimal:
+ [0.5000000]
+ [0.5000000]
+
+Note that these solutions are not unique, although the game values are.
Requirements
------------
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
-.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
- @echo " coverage to run coverage check of the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
-coverage:
- $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
- @echo "Testing of coverage in the sources finished, look at the " \
- "results in $(BUILDDIR)/coverage/python.txt."
-
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
- 'sphinx.ext.coverage',
+ 'sphinx.ext.doctest',
'sphinx.ext.napoleon',
'sphinx.ext.pngmath',
'sphinx.ext.viewcode',
autosummary_generate = True
+# Don't automatically test every >>> block in the documentation. This
+# avoids testing the API docs as part of the documentation build,
+# which is exactly what we intend, because those are tested as part of
+# the (much faster) unittest test suite.
+doctest_test_doctest_blocks = ''
+
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
sphinx-apidoc -f -o doc/source $(SRCDIR)
cd doc && $(MAKE) html
+.PHONY: doctest
+doctest:
+ cd doc && $(MAKE) doctest
+
.PHONY: check
check:
python test/suite.py