Skip to content

Commit

Permalink
More tests (#248)
Browse files Browse the repository at this point in the history
* new geojson with intentionally broken feature

* a few additional tests

* log when we do not validate a building, and why

* abandon deprecated OpenStudio method call in favor of current standard

* remove illegal character from display name

* update deprecated MiniTest syntax

* update coveralls action from master to v1 in CI

* need to pin `adressable` for openstudio calls (tests) to work
  • Loading branch information
vtnate committed Aug 28, 2023
1 parent 7278c53 commit fc299b8
Show file tree
Hide file tree
Showing 8 changed files with 805 additions and 34 deletions.
4 changes: 2 additions & 2 deletions lib/measures/urban_geometry_creation/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def arguments(model)
surrounding_buildings.setDefaultValue('ShadingOnly')
args << surrounding_buildings
# not a required argument
scale_footprint_area_by_floor_area = OpenStudio::Ruleset::OSArgument.makeBoolArgument('scale_footprint_area_by_floor_area', false)
scale_footprint_area_by_floor_area.setDisplayName('Scale Footprint Area by the Floor Area?')
scale_footprint_area_by_floor_area = OpenStudio::Measure::OSArgument.makeBoolArgument('scale_footprint_area_by_floor_area', false)
scale_footprint_area_by_floor_area.setDisplayName('Scale Footprint Area by the Floor Area')
scale_footprint_area_by_floor_area.setDescription('If true, the footprint area from GeoJSON will be scaled by the floor_area provided by the user in URBANopt.')
scale_footprint_area_by_floor_area.setDefaultValue(false)
args << scale_footprint_area_by_floor_area
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
require_relative '../measure'
require 'fileutils'

class UrbanGeometryCreationTest < MiniTest::Unit::TestCase
class UrbanGeometryCreationTest < MiniTest::Test
def test_shadowed_case
denver_zoo = OpenStudio::PointLatLon.new(39.749242, -104.951024, 0)
blocky = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
require_relative '../measure'
require 'fileutils'

class UrbanGeometryCreationTest < MiniTest::Unit::TestCase
class UrbanGeometryCreationTest < MiniTest::Test
def test_one_building
# create an instance of the measure
measure = UrbanGeometryCreation.new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
require_relative '../measure.rb'
require 'fileutils'

class UrbanGeometryCreationZoningTest < MiniTest::Unit::TestCase
class UrbanGeometryCreationZoningTest < MiniTest::Test
def test_one_building
# create an instance of the measure
measure = UrbanGeometryCreationZoning.new
Expand Down
5 changes: 4 additions & 1 deletion lib/urbanopt/geojson/geo_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def self.from_file(path)
raise('No name found for Building Feature')
end
if feature[:properties][:number_of_stories].nil?
@@logger.warn("Number of stories is required to calculate shading using the UrbanGeometryCreation measure...ignoring #{feature[:properties][:id]} in shading calculations")
@@logger.warn("Number of stories is required to calculate shading using the UrbanGeometryCreation measure.\n" \
"Not validating #{feature[:properties][:id]} against schema and ignoring in shading calculations")
end
feature[:additionalProperties] = true
# In case hpxml_directory present check for fewer properties
Expand All @@ -95,6 +96,8 @@ def self.from_file(path)
if feature[:properties][:name].nil?
raise('No name found for Building Feature')
end
@@logger.warn("OS-HPXML files may not conform to schema, which is usually ok.\n" \
"Not validating #{feature[:properties][:id]} against schema")
# Else validate for all required properties in the schema
else
errors = validate(@@building_schema, properties)
Expand Down

0 comments on commit fc299b8

Please sign in to comment.