2,750 questions
0
votes
3
answers
105
views
Using selenium assert with wait
I'm trying to use asserts in selenium java. I read that for every validation, I need to use an assert as best practice.
I stumbled upon this code example:
WebElement button = wait.until(...
5
votes
1
answer
268
views
How does [[assume]] affect an assert?
The user defined attribute [[assumes(expression)]]
Specifies that the given expression is assumed to always evaluate to true at a given point in order to allow compiler optimizations based on the ...
0
votes
2
answers
170
views
Print only assert message in Python
Is there any way print only assert message:
assert 5==4, "test"
will print:
Traceback (most recent call last):
File "C:\Users\user\temp\test.py", line 4, in <module>
...
2
votes
2
answers
96
views
Confusion on Assert() definition
There's something about the definition of Assert() in postgres that I don't really understand. Here's the defining block in src/include/c.h:
/*
* USE_ASSERT_CHECKING, if defined, turns on all the ...
3
votes
1
answer
80
views
assertEqual tests ok when numpy.ndarray vs str, is that expected? or what have I done wrongly?
My unittest returns ok, but when running my code in production, I found that my value is 'wrapped' with square brackets. Further investigation shows that, it lies under the df.loc[].values . I am ...
-1
votes
1
answer
79
views
Assert struct vector length
My very first project in rust is a small poker like card game that has five columns players put five cards in. Card is a struct that fetches its value and suite from an external API. Board on the ...
0
votes
0
answers
30
views
issue when using the assert macro in C++ with std::map [duplicate]
I’m encountering a puzzling issue when using the assert macro in C++20 with std::map:
Code (Fails to Compile):
#include <bits/stdc++.h>
using namespace std;
int main() {
map<pair<int, ...
1
vote
1
answer
80
views
"quiet" functions and assert condition
I don't understand why the following stopifnot does not error out:
> suppressMessages(library(tidyverse))
> print(.packages())
[1] "lubridate" "forcats" "stringr"...
0
votes
2
answers
79
views
Can't solve this Dafny problem about implementing a O(n) algorithm
predicate Asc(a: array<int>)
reads a
{
forall i,j:: 0<=i<j<a.Length ==> a[i] <= a[j]
}
method occursInBoth(a: array<int>, b: array<int>) returns (r : bool)
...
1
vote
0
answers
49
views
assert that all elements of a list are called on 4 different functions using assertAll
I would like to write a test in which I pass in as an argument a list of values, and I assert that 4 different methods are called using each value. For example
@ParameterizedTest
@SomeKindOfSource
...
0
votes
0
answers
36
views
Assert in TypeScript type definition [duplicate]
Suppose I have a type definition like the following:
type FollowPath<T, P> =
// If the first element of P is a key of T, advance
P extends [infer E extends keyof T, ...infer Ps] ?
...
0
votes
1
answer
167
views
static_assert vs C_ASSERT - which one to use? [closed]
I have a general C++ / Windows question for coding standards regarding compile-time assertions.
static_assert is C++11 and language/compiler supported;
C_ASSERT is a define from winnt.h
So, if I have ...
0
votes
0
answers
24
views
Unable to assert chinese text using selenium java in intellij
I am facing a problem during assertion of chinese text
trying to Change language on the application from English to chinese and assert the text displayed
I am using Cucumber + Testng +Selenium + java+ ...
1
vote
1
answer
46
views
Assert Success in Matlab Without Using Classes
I am writing a validation function in Matlab R2020 to ensure that several arrays meet length requirements before they are processed. The function looks something like
function [arr1, arr2, arr3, arr4] ...
0
votes
2
answers
88
views
Asserting availability of SubTypes of T
I would like to assert whether every element of an array is a sub type of a particular class. So I wrote a helper like this:
private <T> void assertContainsAllSubtypes(
List<? ...
1
vote
1
answer
182
views
How to get detailed assertion error messages from an external assertion function in pytest?
I'm trying to move assert statements out of my test function into a separate function when using pytest. Here is an example:
def assertions():
assert 1 + 1 == 2, 'Addition error'
assert 2 * 2 =...
0
votes
0
answers
71
views
Unit test for pandas NA values in dataframe
I have a function which gives me the following output (pd df):
timestamp
duration
trial_type
blink
message
9199380
<NA>
NaN
<NA>
RECORD_START
9199345
392
fixation
0
NaN
etc...
column ...
0
votes
0
answers
50
views
How can I assert JSON body hidden inside HTML tags with REST Assured?
I have response:
<html>
<body>{"name":"test","value":"new","_id":"578641fec44c56220b15e5f9"}:</body>
</html>
I ...
1
vote
1
answer
257
views
"Assert function" does not change type
I'm trying to make a package like zod for npm but when parsing it it doesn't update the previous type:
function isString(val: unknown): asserts val is string {
if (typeof val !== 'string') throw new ...
1
vote
0
answers
112
views
Rest-Assured and Hamcrest matchers not working with comparing arrays of ints
With Rest Assured i'm parcing rest-response and comparing arrays.
Response body:
{
"error": {
"errorObjects": [
{
"risks": [
{
...
1
vote
2
answers
222
views
Is there an analogue of assertAll for the check method in Kotlin?
junit has assertAll which allows you to perform all the required checks without throwing an exception for one of them, thereby ignoring the rest. For example:
assertAll(
{ assertEquals(a, b) },
...
-2
votes
1
answer
160
views
How assert if String is present in a List of Strings? [duplicate]
How would I create a junit test that checks if given String is present in List of String?
I was thinking using contains but not sure if I am on the right path or not.
0
votes
0
answers
167
views
Can accessing mutex over a loop result in __pthread_mutex_lock: Assertion `mutex->__data-__owner == 0' failed
I have a function which is intermittently throwing the error
__pthread_mutex_lock: Assertion `mutex->__data-__owner == 0' failed.
From my research till now I came to know the following cases in ...
0
votes
0
answers
68
views
Throw an exception in Debug/Debugger attached, but Log Error in Production?
There are some paths that I want to throw an Exception when I'm working / debugging, but pass (and Log an error) when in Release.
This means:
while working/debugging I can investigate the call stack ...
1
vote
2
answers
117
views
What is a good way to verify if arguments of a function are numbers
I have a function which takes in 3 arguments and I want to make sure those three arguments are numbers.
As of right now, I've made this after a bit of experimenting and it seems to work but I'm not ...