8000 Specific asserts by zware · Pull Request #205 · python/typing · GitHub
[go: up one dir, main page]

Skip to content

Specific asserts #205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 19, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use self.assertNotEqual instead of assert ... != ...
  • Loading branch information
zware committed Apr 18, 2016
commit 5ee93c263999af6d14361cac23203991d3973103
30 changes: 15 additions & 15 deletions src/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,18 @@ def test_constrained_error(self):
def test_union_unique(self):
X = TypeVar('X')
Y = TypeVar('Y')
assert X != Y
self.assertNotEqual(X, Y)
self.assertEqual(Union[X], X)
assert Union[X] != Union[X, Y]
self.assertNotEqual(Union[X], Union[X, Y])
self.assertEqual(Union[X, X], X)
assert Union[X, int] != Union[X]
assert Union[X, int] != Union[int]
self.assertNotEqual(Union[X, int], Union[X])
self.assertNotEqual(Union[X, int], Union[int])
self.assertEqual(Union[X, int].__union_params__, (X, int))
self.assertEqual(Union[X, int].__union_set_params__, {X, int})

def test_union_constrained(self):
A = TypeVar('A', str, bytes)
assert Union[A, str] != Union[A]
self.assertNotEqual(Union[A, str], Union[A])

def test_repr(self):
self.assertEqual(repr(T), '~T')
Expand Down Expand Up @@ -381,8 +381,8 @@ def test_basics(self):
def test_equality(self):
self.assertEqual(Tuple[int], Tuple[int])
self.assertEqual(Tuple[int, ...], Tuple[int, ...])
assert Tuple[int] != Tuple[int, int]
assert Tuple[int] != Tuple[int, ...]
self.assertNotEqual(Tuple[int], Tuple[int, int])
self.assertNotEqual(Tuple[int], Tuple[int, ...])

def test_tuple_subclass(self):
class MyTuple(tuple):
Expand Down Expand Up @@ -620,17 +620,17 @@ class C(Generic[T]):

X = C[Tuple[S, T]]
self.assertEqual(X, C[Tuple[S, T]])
assert X != C[Tuple[T, S]]
self.assertNotEqual(X, C[Tuple[T, S]])

Y = X[T, int]
self.assertEqual(Y, X[T, int])
assert Y != X[S, int]
assert Y != X[T, str]
self.assertNotEqual(Y, X[S, int])
self.assertNotEqual(Y, X[T, str])

Z = Y[str]
self.assertEqual(Z, Y[str])
assert Z != Y[int]
assert Z != Y[T]
self.assertNotEqual(Z, Y[int])
self.assertNotEqual(Z, Y[T])

assert str(Z).endswith(
'.C<~T>[typing.Tuple[~S, ~T]]<~S, ~T>[~T, int]<~T>[str]')
Expand Down Expand Up @@ -708,7 +708,7 @@ class Y(C[int]):
def test_eq_1(self):
self.assertEqual(Generic, Generic)
self.assertEqual(Generic[T], Generic[T])
assert Generic[KT] != Generic[VT]
self.assertNotEqual(Generic[KT], Generic[VT])

def test_eq_2(self):

Expand All @@ -719,9 +719,9 @@ class B(Generic[T]):
pass

self.assertEqual(A, A)
assert A != B
self.assertNotEqual(A, B)
self.assertEqual(A[T], A[T])
assert A[T] != B[T]
self.assertNotEqual(A[T], B[T])

def test_multiple_inheritance(self):

Expand Down
0