diff --git a/README.md b/README.md index d703b45..db4c830 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Example: ```python3 >>> from daidepp import AND, PRP, PCE >>> str(AND(PRP(PCE("AUS")), PRP(PCE("AUS", "ENG")))) -`AND ( ( PRP ( PCE ( AUS ) ) ) ( PRP ( PCE ( AUS ENG ) ) ) ( PRP ( PCE ( AUS ENG FRA ) ) ) )` +`AND ( PRP ( PCE ( AUS ) ) ) ( PRP ( PCE ( AUS ENG ) ) ) ( PRP ( PCE ( AUS ENG FRA ) ) )` ``` Each class in `keywords.py` uses different parameters for instantiation, so it is recommended to carefully follow the type hints or checkout `tests/test_keywords.py`, which provides examples for each class. diff --git a/src/daidepp/keywords.py b/src/daidepp/keywords.py index 9e1e7ed..be38858 100644 --- a/src/daidepp/keywords.py +++ b/src/daidepp/keywords.py @@ -300,7 +300,7 @@ def __init__(self, *arrangements): def __str__(self): arr_str = ["( " + str(arr) + " )" for arr in self.arrangments] - return f"AND ( " + " ".join(arr_str) + " )" + return f"AND " + " ".join(arr_str) @dataclass @@ -312,7 +312,7 @@ def __init__(self, *arrangements): def __str__(self): arr_str = ["( " + str(arr) + " )" for arr in self.arrangments] - return f"ORR ( " + " ".join(arr_str) + " )" + return f"ORR " + " ".join(arr_str) @dataclass diff --git a/tests/test_keywords.py b/tests/test_keywords.py index 079f054..d82a484 100644 --- a/tests/test_keywords.py +++ b/tests/test_keywords.py @@ -256,23 +256,23 @@ def test_DMZ(): def test_AND(): and_1 = AND(PRP(PCE("AUS")), PRP(PCE("AUS", "ENG"))) - assert str(and_1) == "AND ( ( PRP ( PCE ( AUS ) ) ) ( PRP ( PCE ( AUS ENG ) ) ) )" + assert str(and_1) == "AND ( PRP ( PCE ( AUS ) ) ) ( PRP ( PCE ( AUS ENG ) ) )" and_2 = AND(PRP(PCE("AUS")), PRP(PCE("AUS", "ENG")), PRP(PCE("AUS", "ENG", "FRA"))) assert ( str(and_2) - == "AND ( ( PRP ( PCE ( AUS ) ) ) ( PRP ( PCE ( AUS ENG ) ) ) ( PRP ( PCE ( AUS ENG FRA ) ) ) )" + == "AND ( PRP ( PCE ( AUS ) ) ) ( PRP ( PCE ( AUS ENG ) ) ) ( PRP ( PCE ( AUS ENG FRA ) ) )" ) def test_ORR(): orr_1 = ORR(PRP(PCE("AUS")), PRP(PCE("AUS", "ENG"))) - assert str(orr_1) == "ORR ( ( PRP ( PCE ( AUS ) ) ) ( PRP ( PCE ( AUS ENG ) ) ) )" + assert str(orr_1) == "ORR ( PRP ( PCE ( AUS ) ) ) ( PRP ( PCE ( AUS ENG ) ) )" orr_2 = ORR(PRP(PCE("AUS")), PRP(PCE("AUS", "ENG")), PRP(PCE("AUS", "ENG", "FRA"))) assert ( str(orr_2) - == "ORR ( ( PRP ( PCE ( AUS ) ) ) ( PRP ( PCE ( AUS ENG ) ) ) ( PRP ( PCE ( AUS ENG FRA ) ) ) )" + == "ORR ( PRP ( PCE ( AUS ) ) ) ( PRP ( PCE ( AUS ENG ) ) ) ( PRP ( PCE ( AUS ENG FRA ) ) )" )