Questions tagged [expectations]

defines a set of expected and/or allowed method/constructor invocations on the mocked types/instances that have been made available to the test through mock fields and/or mock parameters (e.g., in JMockit).

121 questions
1
vote
1 answer

Rhino Mocks : How to change expectation on method, property or field without clear all expectation?

I use Rhino Mocks version 3.6 and the answer that I found here doesn't work in my case : [TestMethod()] public void Test() { IConnected connectable = MockRepository.GenerateStub(); connectable.Stub(c =>…
Brice2Paris
  • 206
  • 2
  • 8
1
vote
1 answer

Mocha expected at most once, invoked twice, but method is clearly invoked only once

I'm using Mocha for mock testing. Below is the relevant code: # test_player.rb should "not download the ppg more than once for a given year" do @durant.expects(:fetch_points_per_game).at_most_once ppg = @durant.points_per_game ppg2=…
Xbox ForSale
  • 11
  • 1
  • 2
1
vote
1 answer

SimpleTest Mock objects: clearing expectations

The short question: Is there a way to reset a Mock object in SimpleTest, removing all expectations? The longer explanation: I have a class that I'm testing using SimpleTest and am having some problem with the Mock objects it is using. The class is a…
nickf
  • 537,072
  • 198
  • 649
  • 721
1
vote
2 answers

Does should_receive do something I don't expect?

Consider the following two trivial models: class Iq def score #Some Irrelevant Code end end class Person def iq_score Iq.new(self).score #error here end end And the following Rspec test: describe "#iq_score" do …
hoffm
  • 2,386
  • 23
  • 36
1
vote
1 answer

Another Variance and Expectation of diffrent portfolios

A and B are two competing companies. An investor decides whether to buy (a) 100 shares of A, or (b) 100 shares of B, or (c) 50 shares of A and 50 shares of B. A profit made on 1 share of A is a random variable X with the distribution P(X = 2) = P(X…
user1319603
  • 765
  • 1
  • 9
  • 13
0
votes
0 answers

How to deal with Unsync Tables in databricks notebooks

So, my question is: i have a bronze - silver injestion, and later this data will be consumed by gold notebooks, i wan't to check if all tables that notebooks uses is updated. What i thinked, use dlt expectations and in my golds, i will create…
0
votes
0 answers

Great Expectations - expect_column_pair_values_to_not_be_equal

Is there a way to achieve the expectation: expect_column_pair_values_to_not_be_equal without having to create a custom expectation. If not what is the easiest way to create a custom expectation doing the desired outcome which is basically a…
0
votes
0 answers

Finding an optimal action score function for Multi-Armed Bandit Problem

Considering a multi-armed bandit problem where there are : C: number of machines T: timesteps m(i) , v(i) = mean and variance of i-th machine's reward distribution A(i) = Selected Machine index at timestep i R(i) = Received Reward at timestep i : ~…
0
votes
0 answers

Is it possible to calculate an exact/approximate expectation over an argmax function of a random variable?

given a non-increasing vector $b\in R^n$ I would like to calculate the expected argmax of the function f(b) = i*b_i. More clear and mathematical meaning. It's worth mentioning that I assume that the vector $b$ is drawn from some known distribution…
Sagi Levy
  • 11
  • 4
0
votes
1 answer

Dot-notation not working with MixtureExpectation?

This is my first post so I apologize for any formatting issues. I'm trying to calculate the expected value of a collection of numbers in Julia, given a probability distribution that is the mixture of two Beta distributions. Using the following code…
0
votes
1 answer

Jmockit StrictExpectations mocking unmocked static method

I am new to jmockit and StrictExpectations. Inside StrictExpectations I have recorded invocation and return value of static method of non-mocked class and the static method is mocked correctly but I don't know why it is happening. I think since the…
Nobita
  • 1
  • 2
0
votes
1 answer

Creating Expectations for all columns of certain type in Palantir Foundry

I use a expectations and Check to determine if a column of decimal type could be transformed into int or long type. A column could be safely transformed if it contains integers or decimals where decimal part only contains zeros. I check it using…
0
votes
0 answers

Best way of testing randomized function

Let's say I have a random number generator for 3 categories: Prob Yield 0.1 10 0.2 5 0.7 2 The expected yield is 1 + 1 + 1.4 = 3.4 Currently I have something like this sum = 0 N = 10000 for i in 1 to N: sum +=…
zs2020
  • 53,766
  • 29
  • 154
  • 219
0
votes
1 answer

Find unbiased estimator for (1+λ)e−λ in a poisson distribution

My Attempt: I tried using the MLE of λ which I find the sample mean. Then using the invariance property and it follows that (1+X¯)e^−X¯will be the MLE of (1+λ)e^−λ but I'm not sure if it is also unbiased.
Hamed Said
  • 41
  • 1
  • 3
0
votes
1 answer

unit testing iOS function with dispatch

I'm working with unit testing for the first time and I'm lost with some specific cases. Despite reading a lot I'm confused about how to test a function like this in iOS: func myFunction() { dispatch_async(dispatch_get_global_queue(…
Wonton
  • 1,033
  • 16
  • 33
1 2 3
8 9