@@ -737,6 +737,46 @@ def test_generic_is_subclass3():
737
737
assert not TypeParser .is_subclass (ty .List [float ], ty .List [int ])
738
738
739
739
740
+ def test_none_is_subclass1 ():
741
+ assert TypeParser .is_subclass (None , ty .Union [int , None ])
742
+
743
+
744
+ def test_none_is_subclass2 ():
745
+ assert not TypeParser .is_subclass (None , ty .Union [int , float ])
746
+
747
+
748
+ def test_none_is_subclass3 ():
749
+ assert TypeParser .is_subclass (ty .Tuple [int , None ], ty .Tuple [int , None ])
750
+
751
+
752
+ def test_none_is_subclass4 ():
753
+ assert TypeParser .is_subclass (None , None )
754
+
755
+
756
+ def test_none_is_subclass5 ():
757
+ assert not TypeParser .is_subclass (None , int )
758
+
759
+
760
+ def test_none_is_subclass6 ():
761
+ assert not TypeParser .is_subclass (int , None )
762
+
763
+
764
+ def test_none_is_subclass7 ():
765
+ assert TypeParser .is_subclass (None , type (None ))
766
+
767
+
768
+ def test_none_is_subclass8 ():
769
+ assert TypeParser .is_subclass (type (None ), None )
770
+
771
+
772
+ def test_none_is_subclass9 ():
773
+ assert TypeParser .is_subclass (type (None ), type (None ))
774
+
775
+
776
+ def test_none_is_subclass10 ():
777
+ assert TypeParser .is_subclass (type (None ), type (None ))
778
+
779
+
740
780
@pytest .mark .skipif (
741
781
sys .version_info < (3 , 9 ), reason = "Cannot subscript tuple in < Py3.9"
742
782
)
@@ -780,3 +820,35 @@ def test_type_is_instance3():
780
820
781
821
def test_type_is_instance4 ():
782
822
assert TypeParser .is_instance (Json , type )
823
+
824
+
825
+ def test_type_is_instance5 ():
826
+ assert TypeParser .is_instance (None , None )
827
+
828
+
829
+ def test_type_is_instance6 ():
830
+ assert TypeParser .is_instance (None , type (None ))
831
+
832
+
833
+ def test_type_is_instance7 ():
834
+ assert not TypeParser .is_instance (None , int )
835
+
836
+
837
+ def test_type_is_instance8 ():
838
+ assert not TypeParser .is_instance (1 , None )
839
+
840
+
841
+ def test_type_is_instance9 ():
842
+ assert TypeParser .is_instance (None , ty .Union [int , None ])
843
+
844
+
845
+ def test_type_is_instance10 ():
846
+ assert TypeParser .is_instance (1 , ty .Union [int , None ])
847
+
848
+
849
+ def test_type_is_instance11 ():
850
+ assert not TypeParser .is_instance (None , ty .Union [int , str ])
851
+
852
+
853
+ def test_type_is_instance12 ():
854
+ assert not TypeParser .is_instance ((1 , None ), ty .Tuple [int , None ])
0 commit comments