Skip to content

Commit d1e8007

Browse files
committed
Move test.
1 parent e04a32f commit d1e8007

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

test/test_operations.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,19 +2367,6 @@ def test_isneginf_no_fallback(self):
23672367
t = t.to(torch.float16)
23682368
self._test_no_fallback(torch.isneginf, (t,))
23692369

2370-
def test_uniform__raises_error_on_invalid_range(self):
2371-
device = torch_xla.device()
2372-
a = torch.empty(5, 5, device=device)
2373-
from_ = 5.
2374-
to_ = 2.
2375-
2376-
try:
2377-
a.uniform_(from_, to_)
2378-
except RuntimeError as e:
2379-
expected_error = (
2380-
"uniform_(): expected `from` (5) to be smaller or equal `to` (2).")
2381-
self.assertEqual(str(e), expected_error)
2382-
23832370

23842371
class MNISTComparator(nn.Module):
23852372

test/test_ops_error_message.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,21 @@ def test():
222222
expect="""roll(): expected `dims` [0] (size=1) to match the size of `shifts` [2, 2] (size=2)."""
223223
)
224224

225+
def test_uniform__raises_error_on_invalid_range(self):
226+
device = torch_xla.device()
227+
a = torch.empty(5, 5, device=device)
228+
from_ = 5.
229+
to_ = 2.
230+
231+
def test():
232+
return a.uniform_(from_, to_)
233+
234+
self.assertExpectedRaisesInline(
235+
exc_type=RuntimeError,
236+
callable=test,
237+
expect="""uniform_(): expected `from` (5) to be smaller or equal `to` (2)."""
238+
)
239+
225240

226241
if __name__ == "__main__":
227242
unittest.main()

0 commit comments

Comments
 (0)