@@ -1706,3 +1706,62 @@ def test_bike_with_parking_penalty_multiple_first_section_mode_park_mode_park_an
1706
1706
1707
1707
assert journey ['sections' ][0 ]['mode' ] in ['bike' , 'walking' ]
1708
1708
assert journey ['sections' ][1 ]['type' ] != 'park'
1709
+
1710
+ def test_bike_park_section_from_to_none (self ):
1711
+ query = (
1712
+ sub_query
1713
+ + "&datetime=20120614T075000"
1714
+ + "&first_section_mode[]=bike"
1715
+ + "&bike_speed=0.05"
1716
+ + "&park_mode=on_street"
1717
+ + "&_access_points=true"
1718
+ )
1719
+
1720
+ response = self .query_region (query )
1721
+ check_best (response )
1722
+
1723
+ journeys = get_not_null (response , 'journeys' )
1724
+ pt_journeys = [j for j in journeys if 'bike' in j ['tags' ] and 'non_pt_bike' not in j ['tags' ]]
1725
+ assert len (pt_journeys ) > 0
1726
+ print ("Blablab" , len (pt_journeys [0 ]["sections" ]))
1727
+ for journey in pt_journeys :
1728
+ assert journey ['sections' ][1 ]['type' ] == 'park'
1729
+ assert 'from' not in journey ['sections' ][1 ]
1730
+ assert 'to' not in journey ['sections' ][1 ]
1731
+
1732
+ def test_bike_traversal_time (self ):
1733
+ query = (
1734
+ sub_query
1735
+ + "&datetime=20120614T075000"
1736
+ + "&first_section_mode[]=bike"
1737
+ + "&bike_speed=0.05"
1738
+ + "&debug=true"
1739
+ + "&_access_points=true"
1740
+ )
1741
+
1742
+ # We begin with a normal request to get the fallback duration without the park_mode
1743
+ response = self .query_region (query )
1744
+ check_best (response )
1745
+ journeys = get_not_null (response , 'journeys' )
1746
+ pt_journeys = [j for j in journeys if 'bike' in j ['tags' ] and 'non_pt_bike' not in j ['tags' ]]
1747
+ assert len (pt_journeys ) == 1
1748
+
1749
+ query = (
1750
+ sub_query
1751
+ + "&datetime=20120614T075000"
1752
+ + "&first_section_mode[]=bike"
1753
+ + "&bike_speed=0.05"
1754
+ + "&park_mode=on_street"
1755
+ + "&_access_points=true"
1756
+ )
1757
+
1758
+ # With a request with the park_mode, we expect the same duration as the previous request if we add the first and the street network section following the park section
1759
+ response_2 = self .query_region (query )
1760
+ check_best (response_2 )
1761
+ journeys_2 = get_not_null (response_2 , 'journeys' )
1762
+ pt_journeys_2 = [j for j in journeys_2 if 'bike' in j ['tags' ] and 'non_pt_bike' not in j ['tags' ]]
1763
+ assert len (pt_journeys_2 ) == 1
1764
+ assert (
1765
+ pt_journeys [0 ]["sections" ][0 ]["duration" ]
1766
+ == pt_journeys_2 [0 ]["sections" ][0 ]["duration" ] + pt_journeys_2 [0 ]["sections" ][2 ]["duration" ]
1767
+ )
0 commit comments