Skip to content

Commit

Permalink
fix(tests): Update tests to reflect new schema objects
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Feb 4, 2020
1 parent d046426 commit 72a72f5
Show file tree
Hide file tree
Showing 19 changed files with 21,335 additions and 21,138 deletions.
2 changes: 1 addition & 1 deletion honeybee_schema/bc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Outdoors(BaseModel):
description='A boolean noting whether the boundary is exposed to wind.'
)

view_factor: Union[Autocalculate, float] = Field(
view_factor: Union[float, Autocalculate] = Field(
Autocalculate(),
ge=0,
le=1,
Expand Down
14 changes: 5 additions & 9 deletions honeybee_schema/energy/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Union

from ._base import NamedEnergyBaseModel
from ..altnumber import Autocalculate


class PeopleAbridged(NamedEnergyBaseModel):
Expand Down Expand Up @@ -43,25 +44,20 @@ class PeopleAbridged(NamedEnergyBaseModel):
'value is 0.30.'
)

latent_fraction: Union[float, str] = Field(
'autocalculate',
latent_fraction: Union[float, Autocalculate] = Field(
Autocalculate(),
ge=0,
le=1,
description='Number for the latent fraction of heat gain due to people or '
'simply the word "autocalculate".'
'an Autocalculate object.'
)

@validator('latent_fraction')
def check_string_latent_fraction(cls, v):
if not isinstance(v, float) and v != 'autocalculate':
raise ValueError('"{}" is not a valid entry for latent_fraction'.format(v))

@root_validator
def check_sum_fractions(cls, values):
"Ensure sum is less than 1."
rad = values.get('radiant_fraction')
latent = values.get('latent_fraction')
if latent is not None and latent != 'autocalculate':
if latent is not None and isinstance(latent, float):
assert rad + latent <= 1, \
'Sum of radiant and latent fractions cannot be greater than 1.'
return values
Expand Down
6 changes: 3 additions & 3 deletions honeybee_schema/energy/schedule.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Schedule Type Limit Schema"""
from pydantic import BaseModel, Field, validator, root_validator, constr, conlist
from typing import List
from typing import List, Union
from enum import Enum
import datetime

Expand Down Expand Up @@ -36,12 +36,12 @@ class ScheduleTypeLimit(NamedEnergyBaseModel):

type: constr(regex='^ScheduleTypeLimit$') = 'ScheduleTypeLimit'

lower_limit: Union[NoLimit, float] = Field(
lower_limit: Union[float, NoLimit] = Field(
default=NoLimit(),
description='Lower limit for the schedule type or NoLimit.'
)

upper_limit: Union[NoLimit, float] = Field(
upper_limit: Union[float, NoLimit] = Field(
default=NoLimit(),
description='Upper limit for the schedule type or NoLimit.'
)
Expand Down
16 changes: 16 additions & 0 deletions samples/ideal_air_default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "IdealAirSystemAbridged",
"name": "Default HVAC System",
"economizer_type": "DifferentialDryBulb",
"demand_controlled_ventilation": false,
"sensible_heat_recovery": 0.0,
"latent_heat_recovery": 0.0,
"heating_air_temperature": 50.0,
"cooling_air_temperature": 13.0,
"heating_limit": {
"type": "Autosize"
},
"cooling_limit": {
"type": "Autosize"
}
}
Loading

0 comments on commit 72a72f5

Please sign in to comment.