Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
francescofuggitti committed May 25, 2023
1 parent df11302 commit c65cd38
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/test_predicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
"""This module contains tests for PDDL predicates."""
from pddl.core import Predicate
from pddl.logic.helpers import variables
from pddl.logic.predicates import EqualTo


class TestPredicateSimpleInitialisation:
"""Test simple predicate initialisation."""

def setup(self):
def setup_method(self):
"""Set up the tests."""
self.a, self.b = variables("a b")
self.predicate = Predicate("P", self.a, self.b)
Expand All @@ -34,3 +35,28 @@ def test_variables(self):
def test_arity(self):
"""Test arity property."""
assert self.predicate.arity == 2


class TestEqualToPredicate:
"""Test the eaual to predicate."""

def setup_method(self):
"""Set up the tests."""
self.left, self.right = variables("l r")
self.equal_to = EqualTo(self.left, self.right)

def test_left(self):
assert self.equal_to.left == self.left

def test_right(self):
assert self.equal_to.right == self.right

def test_to_equal(self):
other = EqualTo(self.left, self.right)
assert self.equal_to == other

def test_to_str(self):
assert str(self.equal_to) == f"(= {str(self.left)} {str(self.right)})"

def test_to_repr(self):
assert repr(self.equal_to) == f"EqualTo({repr(self.left)}, {repr(self.right)})"

0 comments on commit c65cd38

Please sign in to comment.