Best Python code snippet using lemoncheesecake
summary_test.py
Source:summary_test.py  
...139            self.assertEqual("scope/a", self.scalar("a", 1).value[0].tag)140    def test_step(self):141        event = self.scalar_event("a", 1.0, step=333)142        self.assertEqual(333, event.step)143    def test_default_step(self):144        try:145            tf2.summary.experimental.set_step(333)146            # TODO(nickfelt): change test logic so we can just omit `step` entirely.147            event = self.scalar_event("a", 1.0, step=None)148            self.assertEqual(333, event.step)149        finally:150            # Reset to default state for other tests.151            tf2.summary.experimental.set_step(None)152class SummaryV2OpGraphTest(SummaryV2OpTest, tf.test.TestCase):153    def write_scalar_event(self, *args, **kwargs):154        kwargs.setdefault("step", 1)155        # Hack to extract current scope since there's no direct API for it.156        with tf.name_scope("_") as temp_scope:157            scope = temp_scope.rstrip("/_")...test_fdm.py
Source:test_fdm.py  
...88        err = np.abs(method(np.sin, 1) + np.sin(1))89        # Check that it did better than the previous estimator.90        assert err <= err_ref91        err_ref = err92def test_default_step():93    approx(94        central_fdm(2, 1).estimate().step, np.sqrt(2 * np.finfo(np.float64).eps / 10)95    )96def test_zero_bound_fixed():97    m = central_fdm(2, 1)98    f = np.sin99    x = 0100    assert m.bound_estimator(f, x) == 0101    assert m.bound_estimator(f, x, magnitude=True)[0] > 0102    assert m.bound_estimator(f, x, magnitude=True)[1] > 0103    approx(m(f, x), 1)104def test_zero_bound_zero_error_not_fixed():105    m = central_fdm(2, 1)106    f = lambda _: 0...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
