Skip to content
Permalink
Browse files

Add test for stacking penalty.

  • Loading branch information...
Ebag333 committed May 26, 2017
1 parent 1da6728 commit 8a1d7e08825eb1622951f9c7cf1fabae249fb7c7
@@ -64,3 +64,15 @@ def HeronFit(DB, Gamedata, Saveddata):
fit.modules.append(mod)

return fit


# noinspection PyShadowingNames
@pytest.fixture # noqa: F811
def GnosisFit(DB, Gamedata, Saveddata):
print("Creating Gnosis")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Gnosis").first()
ship = Saveddata['Ship'](item)
# setup fit
fit = Saveddata['Fit'](ship, "Gnosis Fit")

return fit
@@ -10,3 +10,27 @@ def StrongBluePillBooster(DB, Gamedata, Saveddata):
print("Creating Strong Blue Pill Booster")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Strong Blue Pill Booster").first()
return Saveddata['Booster'](item)


# noinspection PyShadowingNames
@pytest.fixture # noqa: F811
def DamageControlII(DB, Gamedata, Saveddata):
print("Creating Damage Control II")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Damage Control II").first()
return Saveddata['Module'](item)


# noinspection PyShadowingNames
@pytest.fixture # noqa: F811
def ExperimentalEnergizedAdaptiveNanoMembraneI(DB, Gamedata, Saveddata):
print("Creating Experimental Energized Adaptive Nano Membrane I")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Experimental Energized Adaptive Nano Membrane I").first()
return Saveddata['Module'](item)


# noinspection PyShadowingNames
@pytest.fixture # noqa: F811
def EnergizedAdaptiveNanoMembraneI(DB, Gamedata, Saveddata):
print("Creating Energized Adaptive Nano Membrane I")
item = DB['gamedata_session'].query(Gamedata['Item']).filter(Gamedata['Item'].name == "Energized Adaptive Nano Membrane I").first()
return Saveddata['Module'](item)
@@ -9,7 +9,8 @@

# noinspection PyPackageRequirements
from _development.helpers import DBInMemory as DB, Gamedata, Saveddata # noqa: E402, E401
from _development.helpers_fits import RifterFit, KeepstarFit, HeronFit # noqa: E402, E401
from _development.helpers_fits import RifterFit, KeepstarFit, HeronFit, GnosisFit # noqa: E402, E401
from _development.helpers_items import DamageControlII, ExperimentalEnergizedAdaptiveNanoMembraneI, EnergizedAdaptiveNanoMembraneI # noqa: E402, E401


def test_calculateModifiedAttributes(DB, RifterFit, KeepstarFit): # noqa: F811
@@ -59,6 +60,88 @@ def test_calculateModifiedAttributes(DB, RifterFit, KeepstarFit): # noqa: F811
assert len(getattr(KeepstarFit.ship.itemModifiedAttributes, test_dict)) == keepstar_modifier_dicts[test_dict]


def test_calculateStackingPenaltyNoPenalty(DB, Saveddata, GnosisFit, DamageControlII, ExperimentalEnergizedAdaptiveNanoMembraneI): # noqa: F811
resist_stats = {
"armorEmDamageResonance",
"armorThermalDamageResonance",
"armorKineticDamageResonance",
"armorExplosiveDamageResonance",
}

# Base stats
# resists should equal 32.5%
GnosisFit.clear()
GnosisFit.calculateFitAttributes()
for resist in resist_stats:
assert GnosisFit.ship.getModifiedItemAttr(resist) == 0.675

# Damage Control II
# resists should equal 42.6%
GnosisFit.clear()

DamageControlII.state = Saveddata['State'].ONLINE
GnosisFit.modules.append(DamageControlII)

GnosisFit.calculateFitAttributes()

for resist in resist_stats:
assert GnosisFit.ship.getModifiedItemAttr(resist) == 0.57375

# Damage Control II
# Experimental Energized Adaptive Nano Membrane I
# resists should equal 42.6%
GnosisFit.clear()

DamageControlII.state = Saveddata['State'].ONLINE
GnosisFit.modules.append(ExperimentalEnergizedAdaptiveNanoMembraneI)

GnosisFit.calculateFitAttributes()

for resist in resist_stats:
assert GnosisFit.ship.getModifiedItemAttr(resist) == 0.4876875


def test_calculateStackingPenaltyWithPenalty(DB, Saveddata, GnosisFit, EnergizedAdaptiveNanoMembraneI, ExperimentalEnergizedAdaptiveNanoMembraneI): # noqa: F811
resist_stats = {
"armorEmDamageResonance",
"armorThermalDamageResonance",
"armorKineticDamageResonance",
"armorExplosiveDamageResonance",
}

# Base stats
# resists should equal 32.5%
GnosisFit.clear()
GnosisFit.calculateFitAttributes()
for resist in resist_stats:
assert GnosisFit.ship.getModifiedItemAttr(resist) == 0.675

# Energized Adaptive Nano Membrane I
# resists should equal 42.6%
GnosisFit.clear()

DamageControlII.state = Saveddata['State'].ONLINE
GnosisFit.modules.append(EnergizedAdaptiveNanoMembraneI)

GnosisFit.calculateFitAttributes()

for resist in resist_stats:
assert GnosisFit.ship.getModifiedItemAttr(resist) == 0.57375

# Energized Adaptive Nano Membrane I
# Experimental Energized Adaptive Nano Membrane I
# resists should equal 50.1%
GnosisFit.clear()

DamageControlII.state = Saveddata['State'].ONLINE
GnosisFit.modules.append(ExperimentalEnergizedAdaptiveNanoMembraneI)

GnosisFit.calculateFitAttributes()

for resist in resist_stats:
assert GnosisFit.ship.getModifiedItemAttr(resist) == 0.49895136165236575


def test_calculateModifiedAttributes_withBooster(DB, RifterFit, HeronFit): # noqa: F811
# TODO: This test is not currently functional or meaningful as projections are not happening correctly.
# This is true for all tested branches (master, dev, etc)

0 comments on commit 8a1d7e0

Please sign in to comment.
You can’t perform that action at this time.