Skip to content

Commit

Permalink
✅ Passing test for Instance new attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
amarrerod committed Jul 18, 2024
1 parent c66eb9c commit 41852e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/core/test_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_default_instance_attrs(default_instance):
default_instance.p = 5.0
assert (
default_instance.__repr__()
== "Instance<f=100.0,p=5.0,s=10.0,vars=0,descriptor=3,performance=3>"
== "Instance<f=100.0,p=5.0,s=10.0,vars=0,features=0,descriptor=3,performance=3>"
)
assert (
format(default_instance, "p")
Expand Down Expand Up @@ -130,7 +130,7 @@ def test_boolean(initialised_instance, default_instance):

def test_str():
instance = Instance(fitness=100, p=10.0, s=3.0)
expected = "Instance(f=100.0,p=10.0,s=3.0,descriptor=(),performance=())"
expected = "Instance(f=100.0,p=10.0,s=3.0,features=0,descriptor=(),performance=())"
assert str(instance) == expected


Expand Down
2 changes: 2 additions & 0 deletions tests/qd/test_novelty_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def random_population():
def test_run_nsf(nsf, random_population):
assert nsf._describe_by == "features"
assert all(len(instance.descriptor) != 0 for instance in random_population)
for instance in random_population:
instance.features = np.random.randn(8)
sparseness = nsf.sparseness(random_population)
assert len(sparseness) == len(random_population)

Expand Down

0 comments on commit 41852e9

Please sign in to comment.