Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Jourdan <b.vehikel@googlemail.com>2010-01-17 20:47:48 (GMT)
committer Thomas Jourdan <b.vehikel@googlemail.com>2010-01-17 20:47:48 (GMT)
commit972ca563b8cd3f3c53284cb25c223f7869241060 (patch)
treedf4cc0f666427e45815ab4e595c7e5bb42c4b36d
parent8b758d9966893bc78d8f9733261c8d1c9c818c94 (diff)
Testing backward compatibility
-rw-r--r--ep_stamp_filledcyclic.py7
-rw-r--r--model_population.py6
-rw-r--r--test_suite.py13
3 files changed, 20 insertions, 6 deletions
diff --git a/ep_stamp_filledcyclic.py b/ep_stamp_filledcyclic.py
index cf33415..f54fc3e 100644
--- a/ep_stamp_filledcyclic.py
+++ b/ep_stamp_filledcyclic.py
@@ -40,10 +40,9 @@ class FilledCyclicStamp(model_allele.Allele):
'min' : 0.01, 'max': 0.25},
]
- def __init__(self, trunk, maxstates):
+ def __init__(self, trunk, dummy):
"""Constructor for a flip merger."""
super(FilledCyclicStamp, self).__init__(trunk)
- self.max_states = maxstates
self.order = 1.0 # special case for circle
self.radius = 0.1
@@ -82,7 +81,7 @@ class FilledCyclicStamp(model_allele.Allele):
post: __return__ is not other
post: model_locus.unique_check(__return__, self, other) == ''
"""
- new_one = FilledCyclicStamp(self.get_trunk(), self.max_states)
+ new_one = FilledCyclicStamp(self.get_trunk(), -1)
cross_sequence = model_random.crossing_sequence(2)
new_one.order = self.order if cross_sequence[0] else other.order
new_one.radius = self.radius if cross_sequence[1] else other.radius
@@ -128,7 +127,7 @@ class FilledCyclicStamp(model_allele.Allele):
# check for distinct references, needs to copy content, not references
post: __return__ is not self
"""
- new_one = FilledCyclicStamp(self.get_trunk(), self.max_states)
+ new_one = FilledCyclicStamp(self.get_trunk(), -1)
new_one.order = self.order
new_one.radius = self.radius
return new_one
diff --git a/model_population.py b/model_population.py
index ac56270..396b54e 100644
--- a/model_population.py
+++ b/model_population.py
@@ -61,6 +61,12 @@ class KandidModel(object):
result += ka_debug.dot_ref(anchor, ref)
return result
+ def copy(self):
+ new_one = KandidModel(self.size)
+ new_one.protozoans = [protoz.copy() for protoz in self.protozoans]
+ new_one.fitness = [fit for fit in self.fitness]
+ return new_one
+
def set_flurry_rate(self, value):
"""Set amount of turbulence while breeding a new chromosome.
pre: 0 <= value <= 9
diff --git a/test_suite.py b/test_suite.py
index e634b33..df56801 100644
--- a/test_suite.py
+++ b/test_suite.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+import ka_controller
import os
import sys
import traceback
@@ -71,7 +72,16 @@ class TestKandidModel(unittest.TestCase):
# if x not in ['straight', ]]
# cpool.set('/Protozoon', model_protozoon.MERGER_CONSTRAINT, permitted)
- def test_0importer(self):
+ def test_backward(self):
+ for release in range(2, ka_extensionpoint.revision_number):
+ file_path = kandid.TESTMODEL \
+ + '.v' + str(release)
+ model = model_population.read_file(file_path)
+ self.assertTrue(model is not None)
+ result = model.copy().dot()
+ # Hope to reach this point without an exception
+
+ def test_importer(self):
import_path = ka_importer.get_import_path()
install_marker = os.path.join(ka_debug.DEBUG_PROFILE_PATH,
'net.sourceforge.kandid/data/collection/install.inf')
@@ -90,7 +100,6 @@ class TestKandidModel(unittest.TestCase):
self.assertTrue(len(svg_image_list) > 0)
print mt
-
def test_task(self):
global _test_task_completed_count
_test_task_completed_count = 0