Skip to content

Commit

Permalink
(extensions.diff) updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snake-biscuits committed Jul 21, 2023
1 parent cbab31a commit 42bbabb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
9 changes: 9 additions & 0 deletions bsp_tool/extensions/diff/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
__all__ = ["base", "bsps", "core", "lightmaps", "lumps", "shared", "valve"]

from . import base
from . import bsps
from . import core
from . import lightmaps
from . import lumps
from . import shared
from . import valve
1 change: 1 addition & 0 deletions bsp_tool/extensions/diff/bsps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Any, Dict, List, Generator

from . import base
from . import lumps

from bsp_tool.base import Bsp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,21 @@


class TestBspDiff:
diff = diff.BspDiff(old_bsp, new_bsp)
# TODO: diff.BspDiff(old_bsp, new_bsp) & verify no changes
diff = diff.bsps.BspDiff(old_bsp, new_bsp)
# TODO: diff.bsps.BspDiff(old_bsp, old_bsp) & verify no changes

def test_invalid_lump(self):
with pytest.raises(AttributeError):
print(self.diff.NONEXISTANT_LUMP)

def test_lump_added(self):
lump_diff = self.diff.VISIBILITY
assert isinstance(lump_diff, diff.NoneDiff)
assert isinstance(lump_diff, diff.lumps.NoneDiff)

def test_lump_removed(self):
lump_diff = self.diff.DISPLACEMENT_INFO
assert isinstance(lump_diff, diff.NoneDiff)
assert isinstance(lump_diff, diff.lumps.NoneDiff)


# TODO: TestNoneDiff (short_stats only)
# TODO: TestDiffLumps (assigning diff class)
# -- branches.shared.Entities -> diff.shared.EntitiesDiff
# -- branches.valve.source.PakFile -> diff.valve.source.PakFileDiff
# -- branches.base.* -> diff.base.Diff
# -- RawBspLump -> NotImplementedError
# -- * -> diff.base.Diff
# TODO: save
# TODO: has_no_changes
# TODO: what_changed
10 changes: 10 additions & 0 deletions tests/extensions/diff/test_lumps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from bsp_tool.extensions import diff


# TODO: TestNoneDiff (short_stats only)
# TODO: TestDiffLumps (assigning diff class)
# -- branches.shared.Entities -> diff.shared.EntitiesDiff
# -- branches.valve.source.PakFile -> diff.valve.source.PakFileDiff
# -- branches.base.* -> diff.base.Diff
# -- RawBspLump -> NotImplementedError
# -- * -> diff.base.Diff

0 comments on commit 42bbabb

Please sign in to comment.