Skip to content

Commit 33b71b3

Browse files
committed
Move test.
1 parent f8fa1d5 commit 33b71b3

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
@@ -235,6 +235,21 @@ def test():
235235
expect="""trace(): expected the input tensor f32[2,2,2] to be a matrix (i.e. a 2D tensor)."""
236236
)
237237

238+
def test_uniform__raises_error_on_invalid_range(self):
239+
device = torch_xla.device()
240+
a = torch.empty(5, 5, device=device)
241+
from_ = 5.
242+
to_ = 2.
243+
244+
def test():
245+
return a.uniform_(from_, to_)
246+
247+
self.assertExpectedRaisesInline(
248+
exc_type=RuntimeError,
249+
callable=test,
250+
expect="""uniform_(): expected `from` (5) to be smaller or equal `to` (2)."""
251+
)
252+
238253

239254
if __name__ == "__main__":
240255
unittest.main()

0 commit comments

Comments
 (0)