File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -3326,6 +3326,10 @@ def test_str(self):
3326
3326
s = str (tables )
3327
3327
assert len (s ) > 0
3328
3328
3329
+ def test_nbytes_empty_tables (self ):
3330
+ tables = tskit .TableCollection (1 )
3331
+ assert tables .nbytes == 119
3332
+
3329
3333
def test_nbytes (self , tmp_path , ts_fixture ):
3330
3334
tables = ts_fixture .dump_tables ()
3331
3335
tables .dump (tmp_path / "tables" )
Original file line number Diff line number Diff line change @@ -309,7 +309,12 @@ def asdict(self):
309
309
310
310
@property
311
311
def nbytes (self ):
312
- return self .edge_insertion_order .nbytes + self .edge_removal_order .nbytes
312
+ total = 0
313
+ if self .edge_removal_order is not None :
314
+ total += self .edge_removal_order .nbytes
315
+ if self .edge_insertion_order is not None :
316
+ total += self .edge_insertion_order .nbytes
317
+ return total
313
318
314
319
315
320
def keep_with_offset (keep , data , offset ):
You can’t perform that action at this time.
0 commit comments