def test_len(self): l = [1, 2] dl = make_deferrable(l) self.assertEqual(2, sn.len(dl)) l.append(3) self.assertEqual(3, sn.len(dl))
def test_len(): l = [1, 2] dl = sn.defer(l) assert 2 == sn.len(dl) l.append(3) assert 3 == sn.len(dl)
def test_len(self): l = [1, 2] dl = sn.defer(l) self.assertEqual(2, sn.len(dl)) l.append(3) self.assertEqual(3, sn.len(dl))
def __init__(self): self.valid_systems = ['*'] self.valid_prog_environs = ['*'] self.sourcepath = 'hello_threads.cpp' self.executable_opts = ['16'] self.build_system = 'SingleSource' self.build_system.cxxflags = ['-std=c++11', '-Wall'] num_messages = sn.len( sn.findall(r'\[\s?\d+\] Hello, World\!', self.stdout)) self.sanity_patterns = sn.assert_eq(num_messages, 16)
def assert_successful_execution(self): '''Checks that the program is running on 2 different nodes (nids are different), that IPCMagic is configured and returns the correct end-of-program message (returns the slope parameter in the end).''' nids = sn.extractall(r'nid(?P<nid>\d+)', self.stdout, 'nid', str) return sn.all([ sn.assert_eq(sn.len(nids), 2), sn.assert_ne(nids[0], nids[1]), sn.assert_found(r'slope=\S+', self.stdout) ])
def validate_fixture_resolution(self): return sn.all([ # Access all the fixtures with a fork action. sn.assert_eq( (self.f0.data + self.f1.data + self.f2.data + self.f3.data), 4), # Assert that only one fixture is resolved with join action. sn.assert_eq(sn.len(self.f4), 1), # Assert that the fixtures with join and fork actions resolve to # the same instance for the same scope. sn.assert_eq(self.f4[0], self.f0), # Assert that there are only 4 underlying fixture instances. sn.assert_eq( sn.len({self.f0, self.f1, self.f2, self.f3, *self.f4}), 4), # Assert is_fixture() function sn.assert_true(self.f0.is_fixture()), sn.assert_false(self.is_fixture()) ])
def validate_fixture_resolution(self): fixt_info = type(self).get_variant_info(self.variant_num)['fixtures'] return sn.all([ # Assert that f0 and f1 resolve to the right variants sn.all([sn.assert_eq(self.f0.p, 0), sn.assert_eq(self.f1.p, 1)]), # Assert the outer product of the fixtures variants is correct even # with both fixtures being exactly the same. sn.assert_true(self.f2.variant_num in fixt_info['f2']), sn.assert_true(self.f3.variant_num in fixt_info['f3']), # Assert the join behaviour works correctly sn.assert_eq(sn.len({f.variant_num for f in self.f4}), ParamFixture.num_variants) ])
def assert_num_messages(self): num_messages = sn.len( sn.findall(r'\[\s?\d+\] Hello, World\!', self.stdout)) return sn.assert_eq(num_messages, 16)
def set_sanity_patterns(self): num_messages = sn.len( sn.findall(r'\[\s?\d+\] Hello, World\!', self.stdout)) self.sanity_patterns = sn.assert_eq(num_messages, 16)