@@ -472,34 +472,38 @@ def strip(string):
472472 assert (bitcube .array == flags ).all ()
473473 # Default repr shows data as given
474474 bitwise_str = strip (bitcube .styler .to_string ())
475+ comp = "col0123row00123145672891011312131415"
475476 assert bitwise_str == "col0123row00123145672891011312131415"
476477 # bitset repr shows codes individually, without description
477478 bitcube .values_display = "bitset"
478479 bitset_str = strip (bitcube .styler .to_string ())
479- assert bitset_str = = (
480+ comp = (
480481 "col0123row0{}{1}{2}{1,2}1{4}{1,4}{2,4}{1,2,4}"
481482 "2{8}{1,8}{2,8}{1,2,8}3{4,8}{1,4,8}{2,4,8}{1,2,4,8}"
482483 )
484+ assert bitset_str == comp
483485 # Detailed repr parses and replaces codes with descriptions in given code_dict
484486 bitcube .values_display = "detailed"
485487 detailed_str = strip (bitcube .styler .to_string ())
486- assert detailed_str = = (
488+ comp = (
487489 "col0123row0{}{1:'C1'}{2:'C2'}{1:'C1',2:'C2'}1{4:'C4'}{1:'C1',4:'C4'}"
488490 "{2:'C2',4:'C4'}{1:'C1',2:'C2',4:'C4'}2{8:'C8'}{1:'C1',8:'C8'}"
489491 "{2:'C2',8:'C8'}{1:'C1',2:'C2',8:'C8'}3{4:'C4',8:'C8'}"
490492 "{1:'C1',4:'C4',8:'C8'}{2:'C2',4:'C4',8:'C8'}"
491493 "{1:'C1',2:'C2',4:'C4',8:'C8'}"
492494 )
495+ assert detailed_str == comp
493496 bitcube .codes = {i : f"New{ i } " for i in [1 , 2 , 4 , 8 , 16 ]}
494497 detailed_str = strip (bitcube .styler .to_string ())
495- assert detailed_str = = (
498+ comp = (
496499 "col0123row0{}{1:'New1'}{2:'New2'}{1:'New1',2:'New2'}"
497500 "1{4:'New4'}{1:'New1',4:'New4'}{2:'New2',4:'New4'}"
498501 "{1:'New1',2:'New2',4:'New4'}2{8:'New8'}{1:'New1',8:'New8'}"
499502 "{2:'New2',8:'New8'}{1:'New1',2:'New2',8:'New8'}"
500503 "3{4:'New4',8:'New8'}{1:'New1',4:'New4',8:'New8'}{2:'New2',"
501504 "4:'New4',8:'New8'}{1:'New1',2:'New2',4:'New4',8:'New8'}"
502505 )
506+ assert detailed_str == comp
503507 # reset codes
504508 bitcube .codes = code_dict
505509
@@ -516,7 +520,7 @@ def strip(string):
516520 assert bitframe .shape == (2 , 16 )
517521 # Ensure codes and values_display transferred to derivative product
518522 detailed_str = strip (bitframe .styler .to_string ())
519- assert detailed_str = = (
523+ comp = (
520524 "series0123456789101112131415row0000111122223333"
521525 "col0123012301230123time_index0{}{1:'C1'}{2:'C2'}{1:'C1',2:'C2'}"
522526 "{4:'C4'}{1:'C1',4:'C4'}{2:'C2',4:'C4'}{1:'C1',2:'C2',4:'C4'}{8:'C8'}"
@@ -529,18 +533,20 @@ def strip(string):
529533 "{4:'C4',8:'C8',16:'C16'}{1:'C1',4:'C4',8:'C8',16:'C16'}{2:'C2',4:'C4',"
530534 "8:'C8',16:'C16'}{1:'C1',2:'C2',4:'C4',8:'C8',16:'C16'}"
531535 )
536+ assert detailed_str == comp
532537
533538 bitframe = BitwiseSeriesCollection (np .arange (0 , 32 ).reshape (2 , 16 ))
534539 # New bitframe has no codes_dict, detailed display should be the same as bitset
535540 bitframe .values_display = "bitset"
536541 bitset_str = strip (bitframe .styler .to_string ())
537- assert bitset_str = = (
542+ comp = (
538543 "series(0,)(1,)(2,)(3,)(4,)(5,)(6,)(7,)(8,)(9,)(10,)(11,)(12,)(13,)"
539544 "(14,)(15,)time_index0{}{1}{2}{1,2}{4}{1,4}{2,4}{1,2,4}{8}"
540545 "{1,8}{2,8}{1,2,8}{4,8}{1,4,8}{2,4,8}{1,2,4,8}1{16}{1,16}{2,16}"
541546 "{1,2,16}{4,16}{1,4,16}{2,4,16}{1,2,4,16}{8,16}{1,8,16}{2,8,16}"
542547 "{1,2,8,16}{4,8,16}{1,4,8,16}{2,4,8,16}{1,2,4,8,16}"
543548 )
549+ assert bitset_str == comp
544550 bitframe .values_display = "detailed"
545551 detailed_str = strip (bitframe .styler .to_string ())
546552 assert detailed_str == bitset_str
@@ -550,21 +556,24 @@ def strip(string):
550556 # Series
551557 assert isinstance (bitcube [:, 0 , 0 ], BitwiseSeries )
552558 bitseries = BitwiseSeries (np .arange (0 , 16 ), codes = code_dict )
553- bitwise_str = strip (bitseries ._repr_html_ ())[34 :- 17 ]
554- assert bitwise_str == "00112233445566778899101011111212131314141515"
559+ bitwise_str = strip (bitseries ._repr_html_ ())
560+ comp = "00112233445566778899101011111212131314141515"
561+ assert comp in bitwise_str
555562 bitseries .values_display = "bitset"
556- bitset_str = strip (bitseries ._repr_html_ ())[ 34 : - 18 ]
557- assert bitset_str = = (
563+ bitset_str = strip (bitseries ._repr_html_ ())
564+ comp = (
558565 "0{}1{1}2{2}3{1,2}4{4}5{1,4}6{2,4}7{1,2,4}8{8}9{1,8}"
559566 "10{2,8}11{1,2,8}12{4,8}13{1,4,8}14{2,4,8}15{1,2,4,8}"
560567 )
568+ assert comp in bitset_str
561569 bitseries .values_display = "detailed"
562- detailed_str = strip (bitseries ._repr_html_ ())[ 34 : - 18 ]
563- assert detailed_str = = (
570+ detailed_str = strip (bitseries ._repr_html_ ())
571+ comp = (
564572 "0{}1{1:'C1'}2{2:'C2'}3{1:'C1',2:'C2'}4{4:'C4'}"
565573 "5{1:'C1',4:'C4'}6{2:'C2',4:'C4'}7{1:'C1',2:'C2',4:'C4'}"
566574 "8{8:'C8'}9{1:'C1',8:'C8'}10{2:'C2',8:'C8'}"
567575 "11{1:'C1',2:'C2',8:'C8'}12{4:'C4',8:'C8'}"
568576 "13{1:'C1',4:'C4',8:'C8'}14{2:'C2',4:'C4',8:'C8'}"
569577 "15{1:'C1',2:'C2',4:'C4',8:'C8'}"
570578 )
579+ assert comp in detailed_str
0 commit comments