code
stringlengths
3
6.57k
EvaluationRequest(AbstractModel)
__init__(self)
_deserialize(self, params)
params.get("SessionId")
params.get("Image")
params.get("HcmAppid")
params.get("Url")
params.get("SupportHorizontalImage")
params.get("RejectNonArithmeticImage")
params.get("IsAsync")
params.get("EnableDispRelatedVertical")
params.get("EnableDispMidresult")
params.get("EnablePdfRecognize")
params.get("PdfPageIndex")
EvaluationResponse(AbstractModel)
__init__(self)
_deserialize(self, params)
params.get("SessionId")
params.get("Items")
params.get("Items")
Item()
obj._deserialize(item)
self.Items.append(obj)
params.get("TaskId")
params.get("RequestId")
Item(AbstractModel)
__init__(self)
_deserialize(self, params)
params.get("Item")
params.get("ItemString")
params.get("ItemCoord")
ItemCoord()
self.ItemCoord._deserialize(params.get("ItemCoord")
params.get("Answer")
params.get("ExpressionType")
ItemCoord(AbstractModel)
__init__(self)
_deserialize(self, params)
params.get("Height")
params.get("Width")
params.get("X")
params.get("Y")
GitTests(TestCase)
test_is_git_working_copy(self)
os.path.dirname(os.path.dirname(__file__)
self.assertFalse(git.is_working_copy(test_dir)
self.assertTrue(git.is_working_copy(os.path.dirname(test_dir)
mock.patch("esrally.utils.process.run_subprocess_with_output")
mock.patch("esrally.utils.process.run_subprocess_with_logging")
test_git_version_too_old(self, run_subprocess_with_logging, run_subprocess)
self.assertRaises(exceptions.SystemSetupError)
git.head_revision("/src")
self.assertEqual("Your git version is [1.0.0] but Rally requires at least git 1.9. Please update git.", ctx.exception.args[0])
run_subprocess_with_logging.assert_called_with("git -C /src --version", level=logging.DEBUG)
mock.patch("esrally.utils.io.ensure_dir")
mock.patch("esrally.utils.process.run_subprocess_with_logging")
test_clone_successful(self, run_subprocess_with_logging, ensure_dir)
git.clone(src, remote)
ensure_dir.assert_called_with(src)
run_subprocess_with_logging.assert_called_with("git clone http://github.com/some/project /src")
mock.patch("esrally.utils.io.ensure_dir")
mock.patch("esrally.utils.process.run_subprocess_with_logging")
test_clone_with_error(self, run_subprocess_with_logging, ensure_dir)
self.assertRaises(exceptions.SupplyError)
git.clone(src, remote)
self.assertEqual("Could not clone from [http://github.com/some/project] to [/src]", ctx.exception.args[0])
ensure_dir.assert_called_with(src)
run_subprocess_with_logging.assert_called_with("git clone http://github.com/some/project /src")
mock.patch("esrally.utils.process.run_subprocess")
mock.patch("esrally.utils.process.run_subprocess_with_logging")
test_fetch_successful(self, run_subprocess_with_logging, run_subprocess)
git.fetch("/src", remote="my-origin")
run_subprocess.assert_called_with("git -C /src fetch --prune --quiet my-origin")
mock.patch("esrally.utils.process.run_subprocess")
mock.patch("esrally.utils.process.run_subprocess_with_logging")
test_fetch_with_error(self, run_subprocess_with_logging, run_subprocess)
self.assertRaises(exceptions.SupplyError)
git.fetch("/src", remote="my-origin")
self.assertEqual("Could not fetch source tree from [my-origin]", ctx.exception.args[0])
run_subprocess.assert_called_with("git -C /src fetch --prune --quiet my-origin")
mock.patch("esrally.utils.process.run_subprocess")
mock.patch("esrally.utils.process.run_subprocess_with_logging")
test_checkout_successful(self, run_subprocess_with_logging, run_subprocess)
git.checkout("/src", "feature-branch")
run_subprocess.assert_called_with("git -C /src checkout --quiet feature-branch")
mock.patch("esrally.utils.process.run_subprocess")
mock.patch("esrally.utils.process.run_subprocess_with_logging")
test_checkout_with_error(self, run_subprocess_with_logging, run_subprocess)
self.assertRaises(exceptions.SupplyError)
git.checkout("/src", "feature-branch")
self.assertEqual("Could not checkout branch [feature-branch]. Do you have uncommitted changes?", ctx.exception.args[0])
run_subprocess.assert_called_with("git -C /src checkout --quiet feature-branch")
mock.patch("esrally.utils.process.run_subprocess")
mock.patch("esrally.utils.process.run_subprocess_with_logging")
test_rebase(self, run_subprocess_with_logging, run_subprocess)
git.rebase("/src", remote="my-origin", branch="feature-branch")
mock.call("git -C /src checkout --quiet feature-branch")
mock.call("git -C /src rebase --quiet my-origin/feature-branch")
run_subprocess.assert_has_calls(calls)
mock.patch("esrally.utils.process.run_subprocess")