Пример #1
0
 def list2(obj):
     check_type(List( [[int]] ), obj)
Пример #2
0
 def list3(obj):
     check_type(List( (int, float) ), obj)
Пример #3
0
 def list1(obj):
     check_type(List( [int] ), obj)
Пример #4
0
 def test_hash(self):
     from typecheck import List
     
     class A(object): pass
     class B(A): pass
     
     eq_tests = [
         (List(str, str), List(str, str)),
         (List(A, B), List(A, B)),
         (List(List(int, int), int), List(List(int, int), int)) ]
         
     ne_tests = [
         (List(str, int), List(int, str)),
         (List(A, B), List(B, B)),
         (List(A, B), List(A, A)),
         (List(), List(int, int)),
         (List(List(int, int)), List(List(List(int, int)))),
         (List(int, int), List(int, int, int)) ]
     
     test_hash(eq_tests, ne_tests)
Пример #5
0
 def lis(obj):
     check_type(List(int, float), obj)
Пример #6
0
 def test_equality(self):
     from typecheck import List
     
     class A(object): pass
     class B(A): pass
     
     eq_tests = [
         (List(str), List(str)),
         (List(A), List(A)),
         (List(), List()),
         (List(List(int)), List(List(int))) ]
         
     ne_tests = [
         (List(str), List(int)),
         (List(A), List(B)),
         (List(), List(int)),
         (List(List(int)), List(List(List(int)))),
         (List(int), List(int, int)),
         (List(int), [int]) ]
     
     test_equality(eq_tests, ne_tests)
Пример #7
0
    def test_hash(self):
        from typecheck import List

        class A(object):
            pass

        class B(A):
            pass

        eq_tests = [(List(str), List(str)), (List(A), List(A)),
                    (List(List(int)), List(List(int)))]

        ne_tests = [(List(str), List(int)), (List(A), List(B)),
                    (List(List(int)), List(List(List(int))))]

        self.multipleAssertEqualHashes(eq_tests, ne_tests)