Esempio n. 1
0
    def test_exception_output(capsys: pytest.CaptureFixture[str]) -> None:
        input_size = (1, 1, 28, 28)
        summary(EdgeCaseModel(throw_error=False), input_size=input_size)
        with pytest.raises(RuntimeError):
            summary(EdgeCaseModel(throw_error=True), input_size=input_size)

        verify_output(capsys, "unit_test/test_output/exception.out")
Esempio n. 2
0
 def test_incorrect_model_forward(self):
     with pytest.raises(RuntimeError):
         summary(EdgeCaseModel(throw_error=True), (1, 28, 28))
     with pytest.raises(TypeError):
         summary(EdgeCaseModel(return_str=True), (1, 28, 28))
     with pytest.raises(TypeError):
         summary(EdgeCaseModel(return_class=True), (1, 28, 28))
 def test_incorrect_model_forward() -> None:
     with pytest.raises(RuntimeError):
         summary(EdgeCaseModel(throw_error=True), (1, 28, 28))
     with pytest.raises(RuntimeError):
         summary(EdgeCaseModel(return_str=True), (1, 28, 28))
     with pytest.raises(RuntimeError):
         summary(EdgeCaseModel(return_class=True), (1, 28, 28))
     with pytest.raises(RuntimeError):
         summary(EdgeCaseModel(throw_error=True),
                 [[[torch.randn(1, 28, 28)]]])
Esempio n. 4
0
 def test_incorrect_model_forward() -> None:
     with pytest.raises(RuntimeError):
         summary(EdgeCaseModel(throw_error=True), input_size=(1, 28, 28))
     with pytest.raises(RuntimeError):
         summary(EdgeCaseModel(return_str=True), input_size=(1, 28, 28))
     with pytest.raises(RuntimeError):
         summary(EdgeCaseModel(return_class=True), input_size=(1, 28, 28))
     with pytest.raises(RuntimeError):
         summary(
             EdgeCaseModel(throw_error=True),
             input_data=[[[torch.randn(1, 28, 28)]]],  # type: ignore[list-item]
         )
Esempio n. 5
0
    def test_exception_output(self, capsys):
        summary(EdgeCaseModel(throw_error=False), (1, 28, 28))
        with pytest.raises(RuntimeError):
            summary(EdgeCaseModel(throw_error=True), (1, 28, 28))

        verify_output(capsys, "unit_test/test_output/exception.out")
Esempio n. 6
0
 def test_exceptions(self):
     with pytest.raises(RuntimeError):
         summary(EdgeCaseModel(throw_error=True), (1, 28, 28))
     with pytest.raises(TypeError):
         summary(EdgeCaseModel(return_str=True), (1, 28, 28))