Skip to content

Commit eb1efd9

Browse files
committed
Reorganized tests
1 parent b71e9fe commit eb1efd9

File tree

83 files changed

+3519
-3546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+3519
-3546
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,4 @@ htmlcov
5252

5353
# Other
5454
*.bak
55-
*_ui.py
56-
/plotpy/tests/gui/loadsavecanvas.h5
55+
*_ui.py

doc/dev/guiqwt_to_plotpy.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ As a consequence :
5353
as stated above, you may consider using the ``'auto'`` value or the
5454
``'manual'`` value.
5555

56-
See demo script `tests/gui/test_plot_types.py`.
56+
See demo script `tests/features/test_plot_types.py`.
5757

5858
Minor changes to the BasePlot class
5959
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -136,7 +136,7 @@ Some new methods were added to class :py:class:`.PlotManager`:
136136
You may use those methods to simplify you code if you were previously registering
137137
annotation tools one by one.
138138

139-
See demo script `tests/gui/test_annotations.py`.
139+
See demo script `tests/items/test_annotations.py`.
140140

141141
New contour features
142142
~~~~~~~~~~~~~~~~~~~~
@@ -145,7 +145,7 @@ plotpy integrates now a contour detection algorithm, so that plotpy based
145145
applications depending on matplotlib only for this function can drop this
146146
additional dependency.
147147

148-
See demo script `tests/gui/test_contour.py`.
148+
See demo script `tests/items/test_contour.py`.
149149

150150
MaskedXYImages
151151
~~~~~~~~~~~~~~
@@ -156,7 +156,7 @@ You can now use the :py:class:`.MaskedXYImageItem` to apply masks to XYImageItem
156156
You can use the convenience methods :py:meth:`.PlotBuilder.maskedxyimage` to
157157
help you build such items.
158158

159-
See demo script `tests/gui/test_image_masked_xy.py`.
159+
See demo script `tests/items/test_image_masked_xy.py`.
160160

161161
New options added to plot builder
162162
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -174,7 +174,7 @@ New methods for creating ready-to-use plots have been added to the class:
174174
The method :py:meth:`.PlotBuilder.contours` has been added, in order to create
175175
contour curves. It returns a list of :py:class:`plotpy.items.ContourItem` objects.
176176

177-
See demo script `tests/gui/test_contour.py`.
177+
See demo script `tests/items/test_contour.py`.
178178

179179
The new keyword parameter ``alpha_function`` has been added to the methods
180180
:py:meth:`.PlotBuilder.image`, :py:meth:`.PlotBuilder.xyimage`,
@@ -203,22 +203,22 @@ The new keyword parameter ``lut_range`` has been added to the methods
203203
and :py:meth:`.PlotBuilder.trimage`, so you can now avoid to make calls
204204
to set_lut_range after the PlotItem is built.
205205

206-
See demo script `tests/gui/test_builder.py`.
206+
See demo script `tests/features/test_builder.py`.
207207

208208
The method :py:meth:`.PlotBuilder.image` now accepts
209209
optional ``x`` and ``y`` keyword arguments, to automatically create a
210210
:py:class:`plotpy.items.XYImageItem` instead of a simple
211211
:py:class:`plotpy.items.ImageItem` if needed.
212212

213-
See demo script `tests/gui/test_builder.py`.
213+
See demo script `tests/features/test_builder.py`.
214214

215215
The method :py:meth:`.PlotBuilder.curve` now accepts
216216
optional ``dx``, ``dy``, ``errorbarwidth``, ``errorbarcap``, ``errorbarmode``,
217217
`errorbaralpha` keyword arguments, to automatically create a
218218
:py:class:`plotpy.items.ErrorBarCurveItem` instead of a simple
219219
:py:class:`plotpy.items.CurveItem` if needed.
220220

221-
See demo script `tests/gui/test_builder.py`.
221+
See demo script `tests/features/test_builder.py`.
222222

223223
Transformation (translation, rotate, resize) of ImageItem
224224
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -231,4 +231,4 @@ Auto-scaling and shapes
231231
Auto-scaling takes now into account visible shapes
232232
(subclasses of :py:class:`.PolygonShape`).
233233

234-
See demo script `tests/gui/test_autoscale_shapes.py`.
234+
See demo script `tests/features/test_autoscale_shapes.py`.

doc/dev/v1_to_v2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ New methods for creating ready-to-use plots have been added to the class:
4646
The method :py:meth:`.PlotBuilder.contours` has been added, in order to create
4747
contour curves. It returns a list of :py:class:`plotpy.items.ContourItem` objects.
4848

49-
See demo script `tests/gui/test_contour.py`.
49+
See demo script `tests/items/test_contour.py`.
5050

5151
The new keyword parameter ``alpha_function`` has been added to the methods
5252
:py:meth:`.PlotBuilder.image`, :py:meth:`.PlotBuilder.xyimage`,

doc/features/plot/examples.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ a simple plot with a curve and a filtering tool. In this example, the plot
99
manager (see :class:`.PlotManager`) is not used, at least not directly:
1010
the plot manager is integrated in the :class:`.PlotWidget` class.
1111

12-
.. literalinclude:: ../../../plotpy/tests/gui/test_filtertest1.py
12+
.. literalinclude:: ../../../plotpy/tests/widgets/test_filtertest1.py
1313
:start-after: guitest:
1414

1515
Using a plot manager
@@ -20,5 +20,5 @@ Even if this simple example does not justify the use of the :class:`.PlotManager
2020
applications, using the :class:`.PlotManager` allows to design highly versatile
2121
graphical user interfaces.
2222

23-
.. literalinclude:: ../../../plotpy/tests/gui/test_filtertest2.py
23+
.. literalinclude:: ../../../plotpy/tests/widgets/test_filtertest2.py
2424
:start-after: guitest:

doc/features/tools/examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Example
44
The following example add all the existing image tools to a :class:`.PlotWidget`
55
object for testing purpose:
66

7-
.. literalinclude:: ../../../plotpy/tests/gui/test_image_plot_tools.py
7+
.. literalinclude:: ../../../plotpy/tests/tools/test_image_plot_tools.py
88
:start-after: guitest:
99

1010
.. image:: /images/screenshots/image_plot_tools.png

doc/intro/examples.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The test launcher
88

99
A lot of examples are available in the `plotpy.tests` test module ::
1010

11-
from plotpy.tests.gui import run
11+
from plotpy.tests import run
1212
run()
1313

1414
The two lines above execute the `test launcher`:
@@ -22,7 +22,7 @@ Curve plotting
2222
Basic curve plotting
2323
~~~~~~~~~~~~~~~~~~~~
2424

25-
.. literalinclude:: ../../plotpy/tests/gui/test_plot.py
25+
.. literalinclude:: ../../plotpy/tests/items/test_curve.py
2626
:start-after: guitest:
2727

2828

@@ -34,7 +34,7 @@ Basic curve plotting
3434
Computations on curves
3535
~~~~~~~~~~~~~~~~~~~~~~
3636

37-
.. literalinclude:: ../../plotpy/tests/gui/test_computations.py
37+
.. literalinclude:: ../../plotpy/tests/features/test_computations.py
3838
:start-after: guitest:
3939

4040

@@ -44,7 +44,7 @@ Computations on curves
4444
Curve fitting
4545
-------------
4646

47-
.. literalinclude:: ../../plotpy/tests/gui/test_fit.py
47+
.. literalinclude:: ../../plotpy/tests/features/test_fit.py
4848
:start-after: guitest:
4949

5050

@@ -57,7 +57,7 @@ Image visualization
5757
Image contrast adjustment
5858
~~~~~~~~~~~~~~~~~~~~~~~~~
5959

60-
.. literalinclude:: ../../plotpy/tests/gui/test_contrast.py
60+
.. literalinclude:: ../../plotpy/tests/features/test_contrast.py
6161
:start-after: guitest:
6262

6363

@@ -66,7 +66,7 @@ Image contrast adjustment
6666
Image cross-sections
6767
~~~~~~~~~~~~~~~~~~~~
6868

69-
.. literalinclude:: ../../plotpy/tests/gui/test_cross_section.py
69+
.. literalinclude:: ../../plotpy/tests/tools/test_cross_section.py
7070
:start-after: guitest:
7171

7272

@@ -77,7 +77,7 @@ Transformable images
7777

7878
Affine transforms example on 3000x3000 images (real-time transforms):
7979

80-
.. literalinclude:: ../../plotpy/tests/gui/test_transform.py
80+
.. literalinclude:: ../../plotpy/tests/items/test_transform.py
8181
:start-after: guitest:
8282

8383

@@ -86,7 +86,7 @@ Affine transforms example on 3000x3000 images (real-time transforms):
8686
Image rectangular filter
8787
~~~~~~~~~~~~~~~~~~~~~~~~
8888

89-
.. literalinclude:: ../../plotpy/tests/gui/test_imagefilter.py
89+
.. literalinclude:: ../../plotpy/tests/features/test_imagefilter.py
9090
:start-after: guitest:
9191

9292

@@ -99,7 +99,7 @@ Histograms
9999
2-D histogram
100100
~~~~~~~~~~~~~
101101

102-
.. literalinclude:: ../../plotpy/tests/gui/test_hist2d.py
102+
.. literalinclude:: ../../plotpy/tests/items/test_hist2d.py
103103
:start-after: guitest:
104104

105105

@@ -112,7 +112,7 @@ Other examples
112112
Dot Array Demo
113113
~~~~~~~~~~~~~~
114114

115-
.. literalinclude:: ../../plotpy/tests/gui/test_dotarraydemo.py
115+
.. literalinclude:: ../../plotpy/tests/widgets/test_dotarraydemo.py
116116
:start-after: guitest:
117117

118118

@@ -121,7 +121,7 @@ Dot Array Demo
121121
Image plot tools
122122
~~~~~~~~~~~~~~~~
123123

124-
.. literalinclude:: ../../plotpy/tests/gui/test_image_plot_tools.py
124+
.. literalinclude:: ../../plotpy/tests/tools/test_image_plot_tools.py
125125
:start-after: guitest:
126126

127127

@@ -130,7 +130,7 @@ Image plot tools
130130
Real-time Mandelbrot plotting
131131
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132132

133-
.. literalinclude:: ../../plotpy/tests/gui/test_mandelbrot.py
133+
.. literalinclude:: ../../plotpy/tests/items/test_mandelbrot.py
134134
:start-after: guitest:
135135

136136

@@ -139,7 +139,7 @@ Real-time Mandelbrot plotting
139139
Simple application
140140
~~~~~~~~~~~~~~~~~~
141141

142-
.. literalinclude:: ../../plotpy/tests/gui/test_simple_window.py
142+
.. literalinclude:: ../../plotpy/tests/widgets/test_simple_window.py
143143
:start-after: guitest:
144144

145145

plotpy/plot/manager.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -720,26 +720,21 @@ def register_all_annotation_tools(self) -> None:
720720
Register all annotation tools for the plot
721721
"""
722722
self.add_separator_tool()
723-
724723
self.add_tool(AnnotatedPointTool)
725724
self.add_tool(AnnotatedSegmentTool)
726-
727725
self.add_tool(AnnotatedRectangleTool)
728726
self.add_tool(AnnotatedObliqueRectangleTool)
729727
self.add_tool(AnnotatedCircleTool)
730728
self.add_tool(AnnotatedEllipseTool)
731-
732729
self.add_tool(LabelTool)
733730

734731
def register_curve_annotation_tools(self) -> None:
735732
"""
736733
Register all curve friendly annotation tools for the plot
737734
"""
738735
self.add_separator_tool()
739-
740736
self.add_tool(AnnotatedPointTool)
741737
self.add_tool(AnnotatedSegmentTool)
742-
743738
self.add_tool(LabelTool)
744739

745740
def register_image_annotation_tools(self) -> None:

plotpy/tests/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
from guidata.configtools import get_module_data_path
1414

15+
import plotpy
16+
1517
TESTDATAPATH = get_module_data_path("plotpy", osp.join("tests", "data"))
1618

1719

@@ -24,7 +26,7 @@ def run() -> None:
2426
"""Run plotpy test launcher"""
2527
from guidata.guitest import run_testlauncher
2628

27-
import plotpy
29+
import plotpy.config # load icons
2830

2931
run_testlauncher(plotpy)
3032

plotpy/tests/benchmarks/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)