# Path: DnD/modules/lib/settingsLib.py
# class RestLength(enum.IntEnum):
#     LONG = 100
#     SHORT = 10
#     TURN = 1
#     NOTHING = 0
# 
#     @classmethod
#     def from_string(cls, value):
#         if value == 'long' or value == 'long rest':
#             return RestLength.LONG
#         elif value == 'short' or value == 'short rest':
#             return RestLength.SHORT
#         elif value == 'turn':
#             return RestLength.TURN
#         else:
#             return RestLength.NOTHING


import unittest
import DnD.modules.lib.interface as iface
import DnD.modules.lib.spellcastingLib as cast
from pathlib import Path
from DnD.modules.lib.settingsLib import RestLength
        slots = cast.OwnedSpellSlots(self.data, self.singleCaster)
        self.assertEqual(slots.max_spell_slots, [999999, 4, 3, 2])
        slots = cast.OwnedSpellSlots(self.data, self.mixedCaster)
        self.assertEqual(slots.max_spell_slots, [999999, 2])
        slots = cast.OwnedSpellSlots(self.data, self.multiCaster)
        self.assertEqual(slots.max_spell_slots, [999999, 3])

    def test_cast(self):
        slots = cast.OwnedSpellSlots(self.data, self.singleCaster)
        slots.cast(3)
        self.assertEqual(self.data.get('/slots/3'), 0)
        with self.assertRaises(cast.OutOfSpells):
            slots.cast(3)
        slots.cast(0)
        self.assertEqual(self.data.get('/slots/0'), 999999)

    def test_regain(self):
        slots = cast.OwnedSpellSlots(self.data, self.singleCaster)
        slots.regain(2)
        self.assertEqual(self.data.get('/slots/2'), 3)
        with self.assertRaises(cast.OverflowSpells):
            slots.regain(2)

    def test_reset(self):
        slots = cast.OwnedSpellSlots(self.data, self.singleCaster)
        slots.reset()
        self.assertEqual(self.data.get('/slots'), [999999, 4, 3, 2])

    def test_rest(self):
        slots = cast.OwnedSpellSlots(self.data, self.singleCaster)

# Path: DnD/modules/lib/settingsLib.py
# class RestLength(enum.IntEnum):
#     LONG = 100
#     SHORT = 10
#     TURN = 1
#     NOTHING = 0
# 
#     @classmethod
#     def from_string(cls, value):
#         if value == 'long' or value == 'long rest':
#             return RestLength.LONG
#         elif value == 'short' or value == 'short rest':
#             return RestLength.SHORT
#         elif value == 'turn':
#             return RestLength.TURN
#         else:
#             return RestLength.NOTHING


# Path: tests/test_spellcasting.py
import unittest
import DnD.modules.lib.interface as iface
import DnD.modules.lib.spellcastingLib as cast
from pathlib import Path
from DnD.modules.lib.settingsLib import RestLength

        slots = cast.OwnedSpellSlots(self.data, self.singleCaster)
        self.assertEqual(slots.max_spell_slots, [999999, 4, 3, 2])
        slots = cast.OwnedSpellSlots(self.data, self.mixedCaster)
        self.assertEqual(slots.max_spell_slots, [999999, 2])
        slots = cast.OwnedSpellSlots(self.data, self.multiCaster)
        self.assertEqual(slots.max_spell_slots, [999999, 3])

    def test_cast(self):
        slots = cast.OwnedSpellSlots(self.data, self.singleCaster)
        slots.cast(3)
        self.assertEqual(self.data.get('/slots/3'), 0)
        with self.assertRaises(cast.OutOfSpells):
            slots.cast(3)
        slots.cast(0)
        self.assertEqual(self.data.get('/slots/0'), 999999)

    def test_regain(self):
        slots = cast.OwnedSpellSlots(self.data, self.singleCaster)
        slots.regain(2)
        self.assertEqual(self.data.get('/slots/2'), 3)
        with self.assertRaises(cast.OverflowSpells):
            slots.regain(2)

    def test_reset(self):
        slots = cast.OwnedSpellSlots(self.data, self.singleCaster)
        slots.reset()
        self.assertEqual(self.data.get('/slots'), [999999, 4, 3, 2])

    def test_rest(self):
        slots = cast.OwnedSpellSlots(self.data, self.singleCaster)

        slots.rest(RestLength.SHORT)