Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bindings/pyroot/cppyy/cppyy/test/test_operators.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import py
from pytest import raises, skip
from .support import setup_make, pylong, maxvalue, IS_WINDOWS

Check failure on line 3 in bindings/pyroot/cppyy/cppyy/test/test_operators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

bindings/pyroot/cppyy/cppyy/test/test_operators.py:1:1: I001 Import block is un-sorted or un-formatted

currpath = py.path.local(__file__).dirpath()
test_dct = str(currpath.join("operatorsDict"))
Expand Down Expand Up @@ -56,7 +56,7 @@
n /= number(2)
assert n == number(100)

nn = -n;

Check failure on line 59 in bindings/pyroot/cppyy/cppyy/test/test_operators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E703)

bindings/pyroot/cppyy/cppyy/test/test_operators.py:59:16: E703 Statement ends with an unnecessary semicolon
assert nn == number(-100)

def test03_comparison_operators(self):
Expand All @@ -66,12 +66,12 @@

number = cppyy.gbl.number

assert (number(20) > number(10)) == True

Check failure on line 69 in bindings/pyroot/cppyy/cppyy/test/test_operators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E712)

bindings/pyroot/cppyy/cppyy/test/test_operators.py:69:16: E712 Avoid equality comparisons to `True`; use `number(20) > number(10):` for truth checks
assert (number(20) < number(10)) == False

Check failure on line 70 in bindings/pyroot/cppyy/cppyy/test/test_operators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E712)

bindings/pyroot/cppyy/cppyy/test/test_operators.py:70:16: E712 Avoid equality comparisons to `False`; use `not number(20) < number(10):` for false checks
assert (number(20) >= number(20)) == True

Check failure on line 71 in bindings/pyroot/cppyy/cppyy/test/test_operators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E712)

bindings/pyroot/cppyy/cppyy/test/test_operators.py:71:16: E712 Avoid equality comparisons to `True`; use `number(20) >= number(20):` for truth checks
assert (number(20) <= number(10)) == False

Check failure on line 72 in bindings/pyroot/cppyy/cppyy/test/test_operators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E712)

bindings/pyroot/cppyy/cppyy/test/test_operators.py:72:16: E712 Avoid equality comparisons to `False`; use `not number(20) <= number(10):` for false checks
assert (number(20) != number(10)) == True

Check failure on line 73 in bindings/pyroot/cppyy/cppyy/test/test_operators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E712)

bindings/pyroot/cppyy/cppyy/test/test_operators.py:73:16: E712 Avoid equality comparisons to `True`; use `number(20) != number(10):` for truth checks
assert (number(20) == number(10)) == False

Check failure on line 74 in bindings/pyroot/cppyy/cppyy/test/test_operators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E712)

bindings/pyroot/cppyy/cppyy/test/test_operators.py:74:16: E712 Avoid equality comparisons to `False`; use `not number(20) == number(10):` for false checks

def test04_boolean_operator(self):
"""Test implementation of operator bool"""
Expand Down Expand Up @@ -101,11 +101,11 @@
assert o.m_str == 'operator_const_char_star'
assert str(o) == 'operator_const_char_star'

o = gbl.operator_int(); o.m_int = -13

Check failure on line 104 in bindings/pyroot/cppyy/cppyy/test/test_operators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E702)

bindings/pyroot/cppyy/cppyy/test/test_operators.py:104:31: E702 Multiple statements on one line (semicolon)
assert o.m_int == -13
assert int(o) == -13

o = gbl.operator_long(); o.m_long = 42

Check failure on line 108 in bindings/pyroot/cppyy/cppyy/test/test_operators.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E702)

bindings/pyroot/cppyy/cppyy/test/test_operators.py:108:32: E702 Multiple statements on one line (semicolon)
assert o.m_long == 42
assert pylong(o) == 42

Expand Down Expand Up @@ -336,6 +336,7 @@
b = ns.Bar()
assert b[42] == 42

@mark.xfail(reason='Fails on macOS and on Linux with gcc 16 because cppyy picks the wrong "operator-" overload.')
def test15_class_and_global_mix(self):
"""Iterator methods have both class and global overloads"""

Expand All @@ -346,6 +347,10 @@

x = std.vector[int]([1,2,3])
assert (x.end() - 1).__deref__() == 3
# Next line fails with "TypeError: int/long conversion expects an integer object".
# The subtraction should pick the (iterator, iterator) -> int overload,
# but it somehow chooses the (iterator, iterator) -> iterator overload
# with compiling ROOT with gcc 16. TODO: fix this.
assert std.max_element(x.begin(), x.end())-x.begin() == 2
assert (x.end() - 3).__deref__() == 1

Expand Down
1 change: 1 addition & 0 deletions bindings/pyroot/pythonizations/test/import_load_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class ImportLoadLibs(unittest.TestCase):
'ld.*',
'libffi',
'libgcc_s',
'libatomic',
# AddressSanitizer runtime and ROOT configuration
'libclang_rt.asan-.*',
'libROOTSanitizerConfig',
Expand Down
10 changes: 5 additions & 5 deletions roofit/roofitcore/test/testRooFuncWrapper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
#include <RooWorkspace.h>

#include <ROOT/StringUtils.hxx>
#include <TMath.h>
#include <TROOT.h>
#include <TRandom3.h>
#include <TSystem.h>
#include <TMath.h>

#include <functional>
#include <random>

#include "gtest_wrapper.h"

Expand All @@ -67,13 +67,13 @@ double getNumDerivative(const RooAbsReal &pdf, RooRealVar &var, const RooArgSet

void randomizeParameters(const RooArgSet &parameters)
{
TRandom3 rng(1337);

double lowerBound = -0.1;
double upperBound = 0.1;
std::uniform_real_distribution<double> unif(lowerBound, upperBound);
std::default_random_engine re;

for (auto *param : parameters) {
double mul = unif(re);
double mul = rng.Uniform(lowerBound, upperBound);

auto par = dynamic_cast<RooAbsRealLValue *>(param);
if (!par)
Expand Down
Loading