Skip to content

Sanity check #373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions tests/algorithms/test_enumeration.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ def test_not_verified(self, enum_with_list_req, onebyone_enum, enum_with_crossin
)
assert not MonotoneTreeEnumeration(forest_tiling).verified()

@pytest.mark.xfail
def test_get_genf(self, enum_verified):
x = sympy.Symbol("x")
expected_gf = -(
Expand All @@ -272,7 +271,6 @@ def test_get_genf(self, enum_verified):
expected_gf = -1 / ((x - 1) * (x / (x - 1) + 1))
assert sympy.simplify(enum_no_start.get_genf() - expected_gf) == 0

@pytest.mark.xfail
def test_get_genf_simple(self):
t = Tiling(
obstructions=[
Expand All @@ -285,7 +283,6 @@ def test_get_genf_simple(self):
assert enum.verified()
assert sympy.simplify(enum.get_genf() - sympy.sympify("1/(1-2*x)")) == 0

@pytest.mark.xfail
def test_with_finite_monotone_cell(self):
t = Tiling(
obstructions=[
Expand All @@ -300,7 +297,6 @@ def test_with_finite_monotone_cell(self):
assert enum.verified()
assert enum.get_genf().expand() == sympy.sympify("1+2*x+2*x**2")

@pytest.mark.xfail
def test_with_finite_monotone_cell2(self):
t = Tiling(
obstructions=[
Expand Down Expand Up @@ -367,7 +363,6 @@ def test_interleave_fixed_lengths(self, enum_verified):
+ 20 * x ** 11 * dummy_var ** 3 * cell_var ** 3
)

@pytest.mark.xfail
def test_genf_with_req(self):
t = Tiling(
obstructions=[
Expand All @@ -386,7 +381,6 @@ def test_genf_with_req(self):
terms = [0, 0, 0, 3, 10, 25, 56, 119, 246, 501, 1012]
assert taylor_expand(genf) == terms

@pytest.mark.xfail
def test_genf_with_big_finite_cell(self):
t = Tiling(
obstructions=[
Expand All @@ -412,7 +406,6 @@ def test_genf_with_big_finite_cell(self):
+ 20 * x ** 6
)

@pytest.mark.xfail
def test_with_two_reqs(self):
t = Tiling(
obstructions=(
Expand All @@ -432,7 +425,6 @@ def test_with_two_reqs(self):
assert enum.verified()
assert taylor_expand(enum.get_genf()) == expected_enum

@pytest.mark.xfail
def test_corner(self):
t = Tiling(
obstructions=(
Expand Down
1,017 changes: 540 additions & 477 deletions tests/strategies/test_sanity_check.py

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions tests/test_bijections.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
from tilings.strategies.sliding import SlidingFactory, SlidingStrategy
from tilings.tilescope import TileScope, TileScopePack

pytestmark = pytest.mark.xfail


def find_bijection_between(
searcher1: CombinatorialSpecificationSearcher,
Expand Down Expand Up @@ -151,6 +149,7 @@ def test_bijection_7():
)


@pytest.mark.xfail
def test_bijection_8_cross_domain():
# flake8: noqa
_import_css_example()
Expand Down Expand Up @@ -182,6 +181,7 @@ def test_bijection_8_cross_domain():
_bijection_asserter(find_bijection_between(searcher2, searcher1))


@pytest.mark.xfail
def test_bijection_9_cross_domain():
# flake8: noqa
_import_css_example()
Expand Down Expand Up @@ -487,6 +487,7 @@ def test_bijection_14_json():
_bijection_asserter(Bijection.from_dict(json.loads(json.dumps(bi.to_jsonable()))))


@pytest.mark.xfail
@pytest.mark.slow
def test_bijection_15_fusion():
pack = TileScopePack.row_and_col_placements(row_only=True).make_fusion(tracked=True)
Expand Down Expand Up @@ -799,6 +800,7 @@ def test_bijection_15_fusion():
)


@pytest.mark.xfail
def test_bijection_16_fusion_json():
pack = TileScopePack(
initial_strats=[strat.FactorFactory()],
Expand Down Expand Up @@ -828,6 +830,7 @@ def test_bijection_16_fusion_json():
_bijection_asserter(bi_from_dict)


@pytest.mark.xfail
def test_atom_assumption_path_mismatch():
path1 = [
(
Expand Down Expand Up @@ -1278,6 +1281,7 @@ def test_atom_assumption_path_mismatch():
).assumptions_match_down_to_atom()


@pytest.mark.xfail
def test_atom_assumption_path_match():
path1 = [
(
Expand Down
6 changes: 4 additions & 2 deletions tests/test_tilescope.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class ComponentFusionStrategy:
pass


pytestmark = pytest.mark.xfail

point_placements = TileScopePack.point_placements()
all_the_strategies_verify_database = TileScopePack.all_the_strategies().make_database()
all_the_strategies_fusion = TileScopePack.all_the_strategies().make_fusion(
Expand Down Expand Up @@ -106,6 +104,7 @@ def test_132_321_genf():
]


@pytest.mark.xfail
@pytest.mark.timeout(20)
def test_123():
searcher = TileScope((Perm((0, 1, 2)),), point_placements_fusion)
Expand All @@ -120,6 +119,7 @@ def test_123_with_db():
assert isinstance(spec, CombinatorialSpecification)


@pytest.mark.xfail
@pytest.mark.timeout(20)
def test_1342_1423():
point_placements_component_fusion = point_placements.make_fusion(
Expand Down Expand Up @@ -305,6 +305,7 @@ def test_expansion():
spec = spec.expand_verified()


@pytest.mark.xfail
@pytest.mark.timeout(30)
def test_domino():
domino = Tiling(
Expand Down Expand Up @@ -383,6 +384,7 @@ def forest_expansion():
]


@pytest.mark.xfail
def test_guided_searcher():
tilescope = TileScope(
"123", TileScopePack.point_placements().make_fusion(tracked=False)
Expand Down
1 change: 0 additions & 1 deletion tests/test_tiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2351,7 +2351,6 @@ def test_is_atom():
assert not empty_set.is_atom()


@pytest.mark.xfail
class TestGetGenf:
"""
Group all the test regarding getting the generating function for a tiling.
Expand Down
3 changes: 3 additions & 0 deletions tilings/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ def __str__(self) -> str:
s += f" col map: {{{col_str}}}"
return s

def __repr__(self) -> str:
return f"{self.__class__.__name__}({self._row_map!r}, {self._col_map!r})"

def __eq__(self, other: object) -> bool:
if not isinstance(other, RowColMap):
return NotImplemented
Expand Down
2 changes: 1 addition & 1 deletion tilings/parameter_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __hash__(self) -> int:
return hash((self.tiling, self.map))

def __repr__(self) -> str:
return f"{self.__class__.__name__}({self.tiling!r}), {self.map!r})"
return f"{self.__class__.__name__}({self.tiling!r}, {self.map!r})"

def __str__(self):
map_str = " " + str(self.map).replace("\n", "\n ")
Expand Down
4 changes: 2 additions & 2 deletions tilings/strategies/requirement_placement.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ def extra_parameters(
raise StrategyDoesNotApply("Strategy does not apply")
algo = self.placement_class(comb_class)
extra_parameters: Tuple[Dict[str, str], ...] = tuple({} for _ in children)
if self.include_empty:
if self.include_empty and not children[0].is_empty():
child = children[0]
for parameter in comb_class.parameters:
mapped_parameter = parameter.add_obstructions_and_requirements(
child.obstructions, []
self.gps, []
).apply_row_col_map(child.forward_map)
parent_var = comb_class.get_parameter_name(parameter)
child_var = child.get_parameter_name(mapped_parameter)
Expand Down
5 changes: 3 additions & 2 deletions tilings/tiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def __init__(
# Set of requirement lists
self._requirements = Tiling.sort_requirements(requirements)
# Set of parameters
self._parameters = tuple(sorted(parameters))
self._parameters = tuple(sorted(set(parameters)))

# Simplify the set of obstructions and the set of requirement lists
if simplify:
Expand Down Expand Up @@ -615,10 +615,11 @@ def add_parameter(self, parameter: ParameterCounter) -> "Tiling":

def add_parameters(self, parameters: Iterable[ParameterCounter]) -> "Tiling":
"""Returns a new tiling with the added parameters."""
sorted_params = sorted(chain(self._parameters, parameters))
tiling = Tiling(
self._obstructions,
self._requirements,
self._parameters + tuple(parameters),
sorted_params,
remove_empty_rows_and_cols=False,
derive_empty=False,
simplify=False,
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ commands = pytest

[pytest]
; Should remove the ignore and add the readme to test path before merging into develop.
addopts = --doctest-modules --doctest-ignore-import-errors --ignore=tests/algorithms/test_sliding_alg.py --ignore=tests/test_assumptions.py --ignore=tests/strategies/test_assumtions_splitting.py --ignore=tests/strategies/test_encoding.py --ignore=tests/strategies/test_reverse_fusion.py --ignore=tests/strategies/test_sanity_check.py --ignore=tests/strategies/test_constructor_equiv.py --ignore=tests/strategies/test_factors.py --ignore=tests/strategies/test_fusion_strat.py --ignore=tests/strategies/test_inferral.py --ignore=tests/strategies/test_rearrange_assumption.py --ignore=tests/strategies/test_symmetries.py --ignore=tests/strategies/test_verification.py
addopts = --doctest-modules --doctest-ignore-import-errors --ignore=tests/algorithms/test_sliding_alg.py --ignore=tests/test_assumptions.py --ignore=tests/strategies/test_assumtions_splitting.py --ignore=tests/strategies/test_encoding.py --ignore=tests/strategies/test_reverse_fusion.py --ignore=tests/strategies/test_constructor_equiv.py --ignore=tests/strategies/test_factors.py --ignore=tests/strategies/test_fusion_strat.py --ignore=tests/strategies/test_inferral.py --ignore=tests/strategies/test_rearrange_assumption.py --ignore=tests/strategies/test_symmetries.py --ignore=tests/strategies/test_verification.py
testpaths = tests tilings
markers = slow: marks tests as slow (deselect with '-m "not slow"')
doctest_optionflags= NORMALIZE_WHITESPACE
Expand Down