Home / Class/ expectThrows Class — pytorch Architecture

expectThrows Class — pytorch Architecture

Architecture documentation for the expectThrows class in test_helpers.h from the pytorch codebase.

Entity Profile

Source Code

aten/src/ATen/core/boxing/impl/test_helpers.h lines 92–102

template <class Exception, class Functor>
inline void expectThrows(Functor&& functor, const char* expectMessageContains) {
  try {
    std::forward<Functor>(functor)();
  } catch (const Exception& e) {
    EXPECT_THAT(e.what(), testing::HasSubstr(expectMessageContains));
    return;
  }
  ADD_FAILURE() << "Expected to throw exception containing \""
                << expectMessageContains << "\" but didn't throw";
}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free