示例#1
0
def test_file_string_methods():
    """Test serialization to/from EPW file strings"""
    relative_path = './tests/assets/epw/chicago.epw'
    epw = EPW(relative_path)

    epw_contents = epw.to_file_string()
    rebuilt_epw = EPW.from_file_string(epw_contents)
    assert epw.location == rebuilt_epw.location
    assert epw.dry_bulb_temperature == rebuilt_epw.dry_bulb_temperature
示例#2
0
def test_epw_from_file_string():
    """Test initialization of EPW from a file string."""
    relative_path = './tests/assets/epw/chicago.epw'
    with open(relative_path, 'r') as epwin:
        file_contents = epwin.read()
    epw = EPW.from_file_string(file_contents)
    assert epw.is_header_loaded
    assert epw.is_data_loaded
    assert len(epw.dry_bulb_temperature) == 8760