Skip to content

Commit 21d68e6

Browse files
committed
fix location is None test
1 parent a4bc05a commit 21d68e6

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

mlir/test/python/ir/context_managers.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,14 @@ def testLocationEnterExit():
3535
# Asserting a different context should clear it.
3636
with Context() as ctx2:
3737
assert Context.current is ctx2
38-
try:
39-
_ = Location.current
40-
except ValueError:
41-
pass
42-
else:
43-
assert False, "Expected exception"
38+
assert Location.current is None
4439

4540
# And should restore.
4641
assert Context.current is ctx1
4742
assert Location.current is loc1
4843

4944
# All should clear.
50-
try:
51-
_ = Location.current
52-
except ValueError as e:
53-
# CHECK: No current Location
54-
print(e)
55-
else:
56-
assert False, "Expected exception"
45+
assert Location.current is None
5746

5847

5948
run(testLocationEnterExit)
@@ -72,12 +61,7 @@ def testInsertionPointEnterExit():
7261
assert InsertionPoint.current is ip
7362
assert Location.current is loc1
7463
# Location should clear.
75-
try:
76-
_ = Location.current
77-
except ValueError:
78-
pass
79-
else:
80-
assert False, "Expected exception"
64+
assert Location.current is None
8165

8266
# Asserting the same Context should preserve.
8367
with ctx1:

0 commit comments

Comments
 (0)