nebius/SWE-bench-extra huggingface dataset:
Repository: godatadriven/evol

Issue:
Not sure if elitism works
I put elitist to True in my mutation step, but it did not work when looking at the source code it looks like it will not work.

`
        elite_fitness = self.current_best if elitist else None
        for individual in self.individuals:
            if elite_fitness is None or individual.fitness != elite_fitness:
                individual.mutate(mutate_function, probability=probability, **kwargs)
        return self
`

elite_fitness is set as an 'individual' object, then in the if statement it is compared to the floating point fitness instead of the actual object. Therefore individual.fitness will never equal elite_fitness and the current_best is not skipped over like it should be.

Comments:

Patch:
diff --git a/evol/__init__.py b/evol/__init__.py
index 6746f75..9f44276 100644
--- a/evol/__init__.py
+++ b/evol/__init__.py
@@ -119,4 +119,4 @@ from .population import Population, ContestPopulation
 from .evolution import Evolution
 from .logger import BaseLogger
 
-__version__ = "0.5.2"
+__version__ = "0.5.3"
diff --git a/evol/population.py b/evol/population.py
index 9a7aedd..8e989f5 100644
--- a/evol/population.py
+++ b/evol/population.py
@@ -207,7 +207,7 @@ class BasePopulation(metaclass=ABCMeta):
         :param kwargs: Arguments to pass to the mutation function.
         :return: self
         """
-        elite_fitness = self.current_best if elitist else None
+        elite_fitness: Optional[float] = self.current_best.fitness if elitist else None
         for individual in self.individuals:
             if elite_fitness is None or individual.fitness != elite_fitness:
                 individual.mutate(mutate_function, probability=probability, **kwargs)


Test patch:
diff --git a/tests/test_population.py b/tests/test_population.py
index 0e441b9..a9b772c 100644
--- a/tests/test_population.py
+++ b/tests/test_population.py
@@ -244,7 +244,7 @@ class TestPopulationMutate:
     def test_mutate_elitist(self):
         pop = Population([1, 1, 3], eval_function=lambda x: x).evaluate().mutate(lambda x: x + 1, elitist=True)
         for chromosome in pop.chromosomes:
-            assert chromosome > 1
+            assert 1 < chromosome <= 3
         assert len(pop) == 3
Repository: goodmami/wn

Issue:
If you try to loop through senses first, hypernym_paths() hangs
Hi,

if you try to loop through senses, then try to find hypernym paths, the code hangs.   Looping through synsets is fine!

For example, the code below will print the path for the synset in the first loop, but hang in the second loop. 


```
##
## MWP
##

import wn
en = wn.Wordnet('omw-en:1.4')

organism = en.synsets(ili='i35563')[0] #beast

for ss in en.synsets(pos='n'):
    if ss == organism:
        print(ss.hypernym_paths())
                
for s in en.senses(pos='n'):
    ss == s.synset()
    if ss == organism:
        print(ss.hypernym_paths())
```


Comments:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 31499b6..4a066dc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,7 +13,9 @@
 * `wn.download()` no longer uses Python features unavailable in 3.7
   when recovering from download errors
 * `Sense.synset()` now creates a `Synset` properly linked to the same
-  `Wordnet` object ([#168])
+  `Wordnet` object ([#157], [#168])
+* `Sense.word()` now creates a `Word` properly linked to the same
+  `Wordnet` object ([#157])
 
 
 ## [v0.9.1]
@@ -585,4 +587,5 @@ abandoned, but this is an entirely new codebase.
 [#154]: https://github.com/goodmami/wn/issues/154
 [#155]: https://github.com/goodmami/wn/issues/155
 [#156]: https://github.com/goodmami/wn/issues/156
+[#157]: https://github.com/goodmami/wn/issues/157
 [#168]: https://github.com/goodmami/wn/issues/168
diff --git a/wn/_core.py b/wn/_core.py
index e74b928..0d89f42 100644
--- a/wn/_core.py
+++ b/wn/_core.py
@@ -891,7 +891,7 @@ class Sense(_Relatable):
             Word('pwn-spigot-n')
 
         """
-        return word(id=self._entry_id)
+        return self._wordnet.word(id=self._entry_id)
 
     def synset(self) -> Synset:
         """Return the synset of the sense.


Test patch:
diff --git a/tests/secondary_query_test.py b/tests/secondary_query_test.py
index 9b97187..56d91b0 100644
--- a/tests/secondary_query_test.py
+++ b/tests/secondary_query_test.py
@@ -38,6 +38,16 @@ def test_sense_synset():
             == wn.synset('test-es-0001-n'))
 
 
+@pytest.mark.usefixtures('mini_db')
+def test_sense_issue_157():
+    # https://github.com/goodmami/wn/issues/157
+    sense = wn.sense('test-en-information-n-0001-01')
+    # This test uses non-public members, which is not ideal, but there
+    # is currently no better alternative.
+    assert sense._wordnet is sense.word()._wordnet
+    assert sense._wordnet is sense.synset()._wordnet
+
+
 @pytest.mark.usefixtures('mini_db')
 def test_sense_examples():
     assert wn.sense('test-en-information-n-0001-01').examples() == []