コード例 #1
0
ファイル: test_soundfile.py プロジェクト: HaroldMills/Vesper
def _get_test_audio_file_path():
    dir_path = test_utils.get_test_data_dir_path(__file__)
    return os.path.join(dir_path, 'test.wav')
コード例 #2
0
import datetime
import os.path

import pytz

from vesper.mpg_ranch.recording_file_parser import RecordingFileParser
from vesper.tests.test_case import TestCase
import vesper.tests.test_utils as test_utils
import vesper.util.time_utils as time_utils


DATA_DIR_PATH = test_utils.get_test_data_dir_path(__file__)


class Station:
    
    def __init__(self, name):
        self.name = name
        
    def local_to_utc(self, dt):
        return to_utc(dt)
    
       
def create_station(name):
    return Station(name)


STATIONS = [
    Station('Floodplain'),
    Station('Ridge'),
    Station('Sheep Camp')
コード例 #3
0
from pathlib import Path

from vesper.tests.test_case import TestCase
from vesper.util.settings import Settings
from vesper.util.settings_type import SettingsType
import vesper.tests.test_utils as test_utils

_DATA_DIR_PATH = Path(test_utils.get_test_data_dir_path(__file__))
_SETTINGS_FILE_PATH = _DATA_DIR_PATH / 'Settings.yaml'


class SettingsTypeTests(TestCase):
    def test_init(self):

        cases = [('One', Settings()), ('Two', Settings(x=1))]

        for name, defaults in cases:
            t = SettingsType(name, defaults)
            self.assertEqual(t.name, name)
            self.assertEqual(t.defaults, defaults)

    def test_create_settings_from_dict(self):
        t = self._create_test_settings_type()
        s = t.create_settings_from_dict({'y': 3, 'z': 4})
        self._assert_created_settings(s)

    def _create_test_settings_type(self):
        defaults = Settings(x=1, y=2)
        return SettingsType('Bobo', defaults)

    def _assert_created_settings(self, settings):
コード例 #4
0
def _get_test_audio_file_path():
    dir_path = test_utils.get_test_data_dir_path(__file__)
    return os.path.join(dir_path, 'test.wav')