Skip to content

Commit b66ef5f

Browse files
committed
Move test.
1 parent e07bc5c commit b66ef5f

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
@@ -179,3 +179,18 @@ def test():
179179
callable=test,
180180
expect="""mm(): cannot matrix-multiply tensors f32[2,5] and f32[8,2]. Expected the size of dimension 1 of the first input tensor (5) to be equal the size of dimension 0 of the second input tensor (8)."""
181181
)
182+
183+
def test_uniform__raises_error_on_invalid_range(self):
184+
device = torch_xla.device()
185+
a = torch.empty(5, 5, device=device)
186+
from_ = 5.
187+
to_ = 2.
188+
189+
def test():
190+
return a.uniform_(from_, to_)
191+
192+
self.assertExpectedRaisesInline(
193+
exc_type=RuntimeError,
194+
callable=test,
195+
expect="""uniform_(): expected `from` (5) to be smaller or equal `to` (2)."""
196+
)

0 commit comments

Comments
 (0)