@@ -457,7 +457,7 @@ mod test {
457457 use maplit:: hashmap;
458458 use pyo3:: types:: PyDict ;
459459 use pyo3:: { PyResult , Python } ;
460- use serde:: { Deserialize , Serialize } ;
460+ use serde:: Serialize ;
461461
462462 fn test_ser < T > ( src : T , expected : & str )
463463 where
@@ -486,15 +486,15 @@ mod test {
486486
487487 #[ test]
488488 fn test_empty_struct ( ) {
489- #[ derive( Serialize , Deserialize ) ]
489+ #[ derive( Serialize ) ]
490490 struct Empty ;
491491
492492 test_ser ( Empty , "null" ) ;
493493 }
494494
495495 #[ test]
496496 fn test_struct ( ) {
497- #[ derive( Serialize , Deserialize ) ]
497+ #[ derive( Serialize ) ]
498498 struct Struct {
499499 foo : String ,
500500 bar : usize ,
@@ -511,7 +511,7 @@ mod test {
511511
512512 #[ test]
513513 fn test_tuple_struct ( ) {
514- #[ derive( Serialize , Deserialize ) ]
514+ #[ derive( Serialize ) ]
515515 struct TupleStruct ( String , usize ) ;
516516
517517 test_ser ( TupleStruct ( "foo" . to_string ( ) , 5 ) , r#"["foo",5]"# ) ;
@@ -534,7 +534,7 @@ mod test {
534534
535535 #[ test]
536536 fn test_enum_unit_variant ( ) {
537- #[ derive( Serialize , Deserialize ) ]
537+ #[ derive( Serialize ) ]
538538 enum E {
539539 Empty ,
540540 }
@@ -544,7 +544,7 @@ mod test {
544544
545545 #[ test]
546546 fn test_enum_tuple_variant ( ) {
547- #[ derive( Serialize , Deserialize ) ]
547+ #[ derive( Serialize ) ]
548548 enum E {
549549 Tuple ( i32 , String ) ,
550550 }
@@ -554,7 +554,7 @@ mod test {
554554
555555 #[ test]
556556 fn test_enum_newtype_variant ( ) {
557- #[ derive( Serialize , Deserialize ) ]
557+ #[ derive( Serialize ) ]
558558 enum E {
559559 NewType ( String ) ,
560560 }
@@ -564,7 +564,7 @@ mod test {
564564
565565 #[ test]
566566 fn test_enum_struct_variant ( ) {
567- #[ derive( Serialize , Deserialize ) ]
567+ #[ derive( Serialize ) ]
568568 enum E {
569569 Struct { foo : String , bar : usize } ,
570570 }
@@ -577,4 +577,53 @@ mod test {
577577 r#"{"Struct":{"foo":"foo","bar":5}}"# ,
578578 ) ;
579579 }
580+
581+ #[ test]
582+ fn test_integers ( ) {
583+ #[ derive( Serialize ) ]
584+ struct Integers {
585+ a : i8 ,
586+ b : i16 ,
587+ c : i32 ,
588+ d : i64 ,
589+ e : u8 ,
590+ f : u16 ,
591+ g : u32 ,
592+ h : u64 ,
593+ }
594+
595+ test_ser (
596+ Integers {
597+ a : 1 ,
598+ b : 2 ,
599+ c : 3 ,
600+ d : 4 ,
601+ e : 5 ,
602+ f : 6 ,
603+ g : 7 ,
604+ h : 8 ,
605+ } ,
606+ r#"{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8}"# ,
607+ )
608+ }
609+
610+ #[ test]
611+ fn test_bool ( ) {
612+ test_ser ( true , "true" ) ;
613+ test_ser ( false , "false" ) ;
614+ }
615+
616+ #[ test]
617+ fn test_none ( ) {
618+ #[ derive( Serialize ) ]
619+ struct S ;
620+
621+ test_ser ( ( ) , "null" ) ;
622+ test_ser ( S , "null" ) ;
623+ }
624+
625+ #[ test]
626+ fn test_bytes ( ) {
627+ test_ser ( b"foo" , "[102,111,111]" ) ;
628+ }
580629}
0 commit comments