From 356e2efc5f3e5d6d084c14d6bccc26fd7efedc79 Mon Sep 17 00:00:00 2001 From: thisandthatuser Date: Thu, 29 Aug 2024 11:20:09 +0200 Subject: [PATCH 1/3] Update _py_algorithms.py --- pygmo/_py_algorithms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmo/_py_algorithms.py b/pygmo/_py_algorithms.py index 6cfa11cb..8eb9314d 100644 --- a/pygmo/_py_algorithms.py +++ b/pygmo/_py_algorithms.py @@ -42,11 +42,11 @@ class scipy_optimize: >>> prob = pg.problem(pg.rosenbrock(10)) >>> pop = pg.population(prob=prob, size=1, seed=0) >>> pop.champion_f[0] - 929975.7994682974 + np.float64(929975.7994682974) >>> scp = pg.algorithm(pg.scipy_optimize(method="L-BFGS-B")) >>> result = scp.evolve(pop).champion_f >>> result[0] # doctest: +ELLIPSIS - 1.13770... + np.float64(1.1377... >>> pop.problem.get_fevals() 55 >>> pop.problem.get_gevals() From 6ec3e9ba2514c8a8884ea96110fc6e23092cf42d Mon Sep 17 00:00:00 2001 From: thisandthatuser Date: Thu, 29 Aug 2024 14:29:49 +0200 Subject: [PATCH 2/3] Update _py_algorithms.py First try. --- pygmo/_py_algorithms.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pygmo/_py_algorithms.py b/pygmo/_py_algorithms.py index 8eb9314d..4398082c 100644 --- a/pygmo/_py_algorithms.py +++ b/pygmo/_py_algorithms.py @@ -41,12 +41,12 @@ class scipy_optimize: >>> import pygmo as pg >>> prob = pg.problem(pg.rosenbrock(10)) >>> pop = pg.population(prob=prob, size=1, seed=0) - >>> pop.champion_f[0] - np.float64(929975.7994682974) + >>> pop.champion_f[0] # doctest: +ELLIPSIS + ...929975.7994682974... >>> scp = pg.algorithm(pg.scipy_optimize(method="L-BFGS-B")) >>> result = scp.evolve(pop).champion_f >>> result[0] # doctest: +ELLIPSIS - np.float64(1.1377... + ...1.1377... >>> pop.problem.get_fevals() 55 >>> pop.problem.get_gevals() From aa5dcc41842768d45a54fca93fbccfe635a27772 Mon Sep 17 00:00:00 2001 From: thisandthatuser Date: Thu, 5 Sep 2024 11:35:01 +0200 Subject: [PATCH 3/3] Update _py_algorithms.py Added brackets to certain instructions to make sure doctest is able to process the ellipses (namely leading ones) as intended. --- pygmo/_py_algorithms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmo/_py_algorithms.py b/pygmo/_py_algorithms.py index 4398082c..9560234d 100644 --- a/pygmo/_py_algorithms.py +++ b/pygmo/_py_algorithms.py @@ -41,11 +41,11 @@ class scipy_optimize: >>> import pygmo as pg >>> prob = pg.problem(pg.rosenbrock(10)) >>> pop = pg.population(prob=prob, size=1, seed=0) - >>> pop.champion_f[0] # doctest: +ELLIPSIS + >>> [pop.champion_f[0]] # doctest: +ELLIPSIS ...929975.7994682974... >>> scp = pg.algorithm(pg.scipy_optimize(method="L-BFGS-B")) >>> result = scp.evolve(pop).champion_f - >>> result[0] # doctest: +ELLIPSIS + >>> [result[0]] # doctest: +ELLIPSIS ...1.1377... >>> pop.problem.get_fevals() 55