コード例 #1
0
ファイル: entity_test.py プロジェクト: snikhil0/ransm
    def testWayEntity(self):
        constant = Containers()
        wayEntity = WayEntity(nodeCacheMock, constant)
        wayEntity.analyze(ways)

        self.assertEqual(wayEntity.max_version, 3)
        self.assertEqual(wayEntity.min_version, 2)
        self.assertEqual(wayEntity.minid, 90088567)
        self.assertEqual(wayEntity.maxid, 90088573)
        self.assertEqual(wayEntity.commonAttributes.tiger_tagged_ways, 1)
        self.assertEqual(wayEntity.commonAttributes.version_increase_over_tiger, 4)
        self.assertEqual(wayEntity.commonAttributes.untouched_by_user_edits, 0)
        self.assertEqual(wayEntity.commonAttributes.sum_versions, 8)
        self.assertEqual(wayEntity.entity_count, 2)

        length_way1 = wayEntity.calc_length([65433897, 259415186, 1044247254, 65486041,
                                             65394577, 689360672, 65396646])
        length_way2 = wayEntity.calc_length([1044247424, 1044247388, 1044247395, 1044247254])

        self.assertEqual(length_way1 + length_way2, wayEntity.length)
        self.assertEqual(len(wayEntity.attribute_models), 1)

        attribute = wayEntity.attribute_models['local']
        self.assertEqual(attribute.commonAttributes.tiger_tagged_ways, 1)
        self.assertEqual(attribute.commonAttributes.untouched_by_user_edits, 0)
        self.assertEqual(attribute.commonAttributes.version_increase_over_tiger, 4)
        self.assertEqual(attribute.commonAttributes.sum_versions, 8)
        self.assertEqual(attribute.sum_way_lengths, length_way1 + length_way2)
        self.assertEqual(attribute.sum_one_way_lengths, length_way1 + length_way2)
        self.assertEqual(attribute.sum_max_speed_lengths, 0)
        self.assertEqual(attribute.number_of_junctions, 0)
        self.assertEqual(attribute.sum_junction_length, 0)
        self.assertEqual(attribute.number_of_access, 0)
        self.assertEqual(attribute.sum_access_length, 0)

        self.assertEqual(wayEntity.tiger_factor(), 0.5)
        self.assertEqual(wayEntity.mean_version, 0) #Not used

        self.assertAlmostEqual(attribute.routing_factor(), 0.30)
        self.assertEqual(attribute.junction_factor(), 0)
        self.assertEqual(attribute.tiger_factor(), 0.5)

        self.assertAlmostEqual(wayEntity.attribute_factor('local'), 0.38)
コード例 #2
0
ファイル: ran_test.py プロジェクト: snikhil0/ransm
 def testRoutingAttributeTemperature(self):
     const = Containers()
     wayEntity = WayEntity(nodeCacheMock, const)
     wayEntity.analyze(ways)
     self.assertAlmostEqual(self.ran.routing_attributes_temperature(wayEntity)[6], 5.168)