Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(0)  |  Derive(0)  |  Import(6)

src/c/o/CoilSnake-HEAD/tests/util/common/test_yml.py   CoilSnake(Download)
 
from coilsnake.util.common.yml import replace_field_in_yml, convert_values_to_hex_repr
from tests.coilsnake_test import BaseTestCase, TemporaryWritableFileTestCase, TEST_DATA_DIR, assert_files_equal
 
 
class TestReplaceFieldInYml(BaseTestCase, TemporaryWritableFileTestCase):
    def test_replace_field_in_yml(self):
        with open(os.path.join(TEST_DATA_DIR, "yml", "sample.yml"), "r") as sample_yml:
            def resource_open_r(name, extension):
                assert_equal(name, "sample_resource")
                assert_equal(extension, "yml")
                return open(os.path.join(TEST_DATA_DIR, "yml", "sample.yml"))
 
 
            assert_files_equal(
                open(os.path.join(TEST_DATA_DIR, "yml", "sample-replaced.yml"), "r"),
                open(self.temporary_wo_file_name, "r"))
 

src/c/o/CoilSnake-HEAD/tests/util/common/test_project.py   CoilSnake(Download)
 
from coilsnake.util.common import project
from tests.coilsnake_test import BaseTestCase, TEST_DATA_DIR
 
 
    def test_load(self):
        self.project.load(os.path.join(TEST_DATA_DIR, "projects", "EB.snake"))
        assert_equal(self.project.romtype, "Earthbound")
        with self.project.get_resource("eb.MapModule", "map") as f:
            assert_equal(f.name, os.path.join(TEST_DATA_DIR, "projects", "eb.MapModule_map.dat"))
 
        with open(os.path.join(TEST_DATA_DIR, "projects", "Dummy.snake")) as f:
    def test_load_new(self):
        self.project.load(os.path.join(TEST_DATA_DIR, "projects", "dne.snake"))
        assert_equal(self.project.romtype, "Unknown")
        assert_equal(self.project._resources, {})
 

src/c/o/CoilSnake-HEAD/tests/modules/eb/test_EbModule.py   CoilSnake(Download)
from coilsnake.model.common.blocks import Rom
from coilsnake.util.eb import native_comp
from tests.coilsnake_test import BaseTestCase, TEST_DATA_DIR
 
 
    def setup(self):
        self.rom = Rom()
        self.rom.from_file(os.path.join(TEST_DATA_DIR, "roms", "EB_fake_24mbit.smc"))
 
    @nottest
    def test_decomp(self, decomp):
        onett_map = array.array('B')
        with Rom() as eb_rom:
            eb_rom.from_file(os.path.join(TEST_DATA_DIR, "roms", "real_EarthBound.smc"))
    def test_comp(self, comp, decomp):
        a = array.array('B')
        with open(os.path.join(TEST_DATA_DIR, "binaries", "compressible.bin"), 'rb') as f:
            a.fromstring(f.read())
        assert_equal(len(a), 18496)
 
        with Rom() as fake_eb_rom:
            fake_eb_rom.from_file(os.path.join(TEST_DATA_DIR, "roms", "EB_fake_32mbit.smc"))
            fake_eb_rom[0x300000:0x300000 + len(compressed_data)] = compressed_data
            reuncompressed_data = decomp(fake_eb_rom, 0x300000)

src/c/o/CoilSnake-HEAD/tests/modules/eb/test_DoorModule.py   CoilSnake(Download)
from coilsnake.modules.eb.DoorModule import DoorModule
from coilsnake.model.common.blocks import Rom
from tests.coilsnake_test import BaseTestCase, TemporaryWritableFileTestCase, TEST_DATA_DIR
 
 
    def test_read_from_rom(self):
        with Rom() as rom:
            rom.from_file(os.path.join(TEST_DATA_DIR, 'roms', 'real_EarthBound.smc'))
            self.test_read_from_rom_using_rom(rom)
 
    def test_write_to_project(self):
        with Rom() as rom:
            rom.from_file(os.path.join(TEST_DATA_DIR, 'roms', 'real_EarthBound.smc'))
            self.module.read_from_rom(rom)
 
    def test_write_to_rom(self):
        with Rom() as rom:
            rom.from_file(os.path.join(TEST_DATA_DIR, 'roms', 'real_EarthBound.smc'))
            self.module.read_from_rom(rom)
 
 
        with Rom() as rom:
            rom.from_file(os.path.join(TEST_DATA_DIR, 'roms', 'real_EarthBound.smc'))
            self.module.write_to_rom(rom)
            self.test_read_from_rom_using_rom(rom)

src/c/o/CoilSnake-HEAD/tests/modules/eb/test_CccInterfaceModule.py   CoilSnake(Download)
from coilsnake.modules.eb import CccInterfaceModule
from coilsnake.util.eb.pointer import from_snes_address
from tests.coilsnake_test import BaseTestCase, TemporaryWritableFileTestCase, TEST_DATA_DIR
 
 
    def test_read_from_project(self):
        with open(os.path.join(TEST_DATA_DIR, 'summary.txt'), 'r') as summary_file:
            def resource_open(a, b):
                return summary_file
 
    def test_read_from_project_blank_summary(self):
        with open(os.path.join(TEST_DATA_DIR, 'summary_blank.txt'), 'r') as summary_file:
            def resource_open(a, b):
                return summary_file
 

src/c/o/CoilSnake-HEAD/tests/model/common/test_blocks.py   CoilSnake(Download)
 
from coilsnake.model.common.blocks import Block, AllocatableBlock, Rom, ROM_TYPE_NAME_UNKNOWN
from tests.coilsnake_test import BaseTestCase, TEST_DATA_DIR
from coilsnake.exceptions.common.exceptions import FileAccessError, OutOfBoundsError, InvalidArgumentError, \
    CouldNotAllocateError, NotEnoughUnallocatedSpaceError
    def test_from_file(self):
        self.block.from_file(os.path.join(TEST_DATA_DIR, "binaries", "1kb_null.bin"))
        assert_equal(len(self.block), 1024)
        assert_list_equal(self.block.to_list(), [0] * 1024)
 
    def test_from_file_unhappy(self):
        # Attempt to load a directory
        assert_raises(FileAccessError, self.block.from_file, TEST_DATA_DIR)
        # Attempt to load a nonexistent file
        assert_raises(FileAccessError, self.block.from_file, os.path.join(TEST_DATA_DIR, "doesnotexist.bin"))
        assert_raises(FileAccessError, self.block.from_file, os.path.join(TEST_DATA_DIR, "doesnotexist.bin"))
        # Attempt to load a file in a nonexistent directory
        assert_raises(FileAccessError, self.block.from_file, os.path.join(TEST_DATA_DIR, "dne", "dne.bin"))
 
    def test_from_list(self):