def test_undefined_blob(self): job = example_job() with job: with Task(): ops.Add(['a', 'b']) with self.assertRaises(AssertionError): net_printer.analyze(job)
def test_valid_job(self): job = example_job() with job: with Task(): # distributed_ctx_init_* ignored by analyzer ops.Add(['distributed_ctx_init_a', 'distributed_ctx_init_b']) net_printer.analyze(example_job())
def test_undefined_blob(self): job = example_job() with job: with Task(): ops.Add(['a', 'b']) with self.assertRaises(AssertionError) as e: net_printer.analyze(job) self.assertEqual("Blob undefined: a", str(e.exception))
def test_multiple_definition(self): job = example_job() with job: with Task(): ops.Add([ops.Const(0), ops.Const(1)], 'out1') with Task(): ops.Add([ops.Const(2), ops.Const(3)], 'out1') with self.assertRaises(AssertionError): net_printer.analyze(job)
def test_multiple_definition(self): job = example_job() with job: with Task(workspace_type=WorkspaceType.GLOBAL): ops.Add([ops.Const(0), ops.Const(1)], 'out1') with Task(workspace_type=WorkspaceType.GLOBAL): ops.Add([ops.Const(2), ops.Const(3)], 'out1') with self.assertRaises(AssertionError): net_printer.analyze(job)