mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Summary: All buck targets that points to caffe2/tools folder are now moved to tools/BUCK. This also eliminates all python library/binary import in pt_defs.bzl, which caused T124308913. Test Plan: CI Differential Revision: D37468313 Pull Request resolved: https://github.com/pytorch/pytorch/pull/80408 Approved by: https://github.com/seemethere, https://github.com/malfet
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
# Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
import unittest
|
|
from unittest.mock import MagicMock
|
|
|
|
from gen_oplist import throw_if_any_op_includes_overloads
|
|
|
|
|
|
class GenOplistTest(unittest.TestCase):
|
|
def setUp(self):
|
|
pass
|
|
|
|
def test_throw_if_any_op_includes_overloads(self):
|
|
selective_builder = MagicMock()
|
|
selective_builder.operators = MagicMock()
|
|
selective_builder.operators.items.return_value = [
|
|
("op1", MagicMock(include_all_overloads=True)),
|
|
("op2", MagicMock(include_all_overloads=False)),
|
|
("op3", MagicMock(include_all_overloads=True)),
|
|
]
|
|
|
|
self.assertRaises(
|
|
Exception, throw_if_any_op_includes_overloads, selective_builder
|
|
)
|
|
|
|
selective_builder.operators.items.return_value = [
|
|
("op1", MagicMock(include_all_overloads=False)),
|
|
("op2", MagicMock(include_all_overloads=False)),
|
|
("op3", MagicMock(include_all_overloads=False)),
|
|
]
|
|
|
|
# Here we do not expect it to throw an exception since none of the ops
|
|
# include all overloads.
|
|
throw_if_any_op_includes_overloads(selective_builder)
|