Skip to content

Commit

Permalink
fixed strict variable for test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Alina Voilova committed Apr 30, 2024
1 parent 068c3a6 commit 4a7a6ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion portfolyo/core/shared/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def plot(self: PfState, children: bool = False) -> plt.Figure:
"""
gridspec = {"width_ratios": [1, 1, 1], "height_ratios": [4, 1]}
fig, (volumeaxes, priceaxes) = plt.subplots(
2, 3, sharex=True, gridspec_kw=gridspec, figsize=(10, 6)
2, 3, sharex=True, sharey="row", gridspec_kw=gridspec, figsize=(10, 6)
)

so, ss, usv = (
Expand Down
24 changes: 18 additions & 6 deletions tests/core/pfline/test_pfline_arithmatic_kind_and_error.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test if arithmatic returns correct type/kind of object and/or correctly raises error."""

from dataclasses import dataclass
from enum import Enum
from functools import lru_cache
Expand All @@ -17,7 +18,14 @@
# TODO: use/change STRICT setting


arithmatic.STRICT = True
@pytest.fixture
def strict_arithmetic():
arithmatic.STRICT = True
yield
arithmatic.STRICT = False


# arithmatic.STRICT = True


class Kind2(Enum): # Kind of value for other operand
Expand Down Expand Up @@ -319,7 +327,9 @@ def from_config(cls, config: CaseConfig, er: ER) -> Iterable[Case]:
),
ids=id_fn,
)
def test_pfl_arithmatic_kind_addraddsubrsub(testcase: Case, operation: str):
def test_pfl_arithmatic_kind_addraddsubrsub(
testcase: Case, operation: str, strict_arithmetic
):
"""Test if arithmatic expectedly raises Error or returns expected type/kind."""
do_kind_test(testcase, operation)

Expand Down Expand Up @@ -383,7 +393,7 @@ def test_pfl_arithmatic_kind_addraddsubrsub(testcase: Case, operation: str):
),
ids=id_fn,
)
def test_pfl_arithmatic_kind_mulrmul(testcase: Case, operation: str):
def test_pfl_arithmatic_kind_mulrmul(testcase: Case, operation: str, strict_arithmetic):
"""Test if arithmatic expectedly raises Error or returns expected type/kind."""
do_kind_test(testcase, operation)

Expand Down Expand Up @@ -456,7 +466,7 @@ def test_pfl_arithmatic_kind_mulrmul(testcase: Case, operation: str):
),
ids=id_fn,
)
def test_pfl_arithmatic_kind_div(testcase: Case, operation: str):
def test_pfl_arithmatic_kind_div(testcase: Case, operation: str, strict_arithmetic):
"""Test if arithmatic expectedly raises Error or returns expected type/kind."""
do_kind_test(testcase, operation)

Expand Down Expand Up @@ -505,7 +515,7 @@ def test_pfl_arithmatic_kind_div(testcase: Case, operation: str):
),
ids=id_fn,
)
def test_pfl_arithmatic_kind_rdiv(testcase: Case, operation: str):
def test_pfl_arithmatic_kind_rdiv(testcase: Case, operation: str, strict_arithmetic):
"""Test if arithmatic expectedly raises Error or returns expected type/kind."""
do_kind_test(testcase, operation)

Expand Down Expand Up @@ -581,7 +591,9 @@ def test_pfl_arithmatic_kind_rdiv(testcase: Case, operation: str):
),
ids=id_fn,
)
def test_pfl_arithmatic_kind_unionrunion(testcase: Case, operation: str):
def test_pfl_arithmatic_kind_unionrunion(
testcase: Case, operation: str, strict_arithmetic
):
"""Test if arithmatic expectedly raises Error or returns expected type/kind."""
do_kind_test(testcase, operation)

Expand Down

0 comments on commit 4a7a6ad

Please sign in to comment.