File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ def __getitem__(self, item: int) -> Branch:
111
111
def init (
112
112
cls ,
113
113
* ,
114
- start_at : datetime | None ,
114
+ start_at : datetime | None = None ,
115
115
end_at : datetime ,
116
116
data : dict [str , Any ],
117
117
meta : dict [str , Any ] | None = None ,
Original file line number Diff line number Diff line change @@ -241,3 +241,14 @@ def test_contract_init_spans_nothing(self):
241
241
end_at = self .start - datetime .timedelta (days = 1 ),
242
242
data = {"key" : "venus" },
243
243
)
244
+
245
+ def test_contract_init_without_start_date (self ):
246
+ delta = datetime .timedelta (hours = 1 )
247
+ contract = Contract .init (data = {}, end_at = datetime .datetime .now (tz = utc ) + delta )
248
+ (branch ,) = contract .items
249
+ # get away from adding freezegun
250
+ self .assertAlmostEqual (
251
+ delta .total_seconds (),
252
+ branch .span .total_seconds (),
253
+ places = 5 ,
254
+ )
You can’t perform that action at this time.
0 commit comments