Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for d in os.listdir('test_common'):
primitive = re.sub(r"\.c$", "", d)
if helpers.permit_test('common', None):
yield check_common, primitive
def check_common(primitive):
binname = os.path.join('..', 'bin', 'test_common_'+primitive)
helpers.make(binname)
helpers.run_subprocess([binname])
if __name__ == '__main__':
try:
import nose2
nose2.main()
except ImportError:
import nose
nose.runmodule()
# set value
MySettings().set_value(name, new_value)
self.assertEqual(MySettings().value(name), new_value)
# remove setting
MySettings().remove(name)
self.assertEqual(MySettings().value(name), default_value)
# bad values
for bad_value in bad_values:
self.assertFalse(MySettings().set_value(name, bad_value))
if __name__ == '__main__':
nose2.main()
if index == 0:
self.assertEqual(
self.dialog.collection_proxy.accepted_status,
COLLECTION_ALL_STATUS)
else:
self.assertEqual(
self.dialog.collection_proxy.accepted_status,
COLLECTION_INSTALLED_STATUS)
else:
# Tab Settings
self.assertEqual(
self.dialog.stacked_menu_widget.currentIndex(), 1)
if __name__ == "__main__":
nose2.main()
)
expected_colorramps = {
'cr_colorbrewer': QgsVectorColorBrewerColorRampV2,
'cr_gradient': QgsVectorGradientColorRampV2,
'cr_random': QgsVectorRandomColorRampV2
}
self.assertEqual(len(extractor.colorramps), len(expected_colorramps))
for colorramp in extractor.colorramps:
self.assertTrue(
isinstance(colorramp['colorramp'],
expected_colorramps[colorramp['name']])
)
if __name__ == "__main__":
nose2.main()
layer = res['TARGET_LAYER']
self.assertEqual(layer.featureCount(), 0) # Selected id has a hole, cannot be copied
self.assertEqual(res[APPENDED_COUNT], 0)
res = self.common._test_copy_selected('source_simple_polygons', 'target_simple_lines', 2)
layer = res['TARGET_LAYER']
self.assertEqual(layer.featureCount(), 1)
self.assertEqual(res[APPENDED_COUNT], 1)
@classmethod
def tearDownClass(self):
print('INFO: Tear down simple_pol-simple_lin')
self.plugin.unload()
if __name__ == '__main__':
nose2.main()
'collections', 'test_collection', 'preview')
]
img_path = 'prev_1.png'
fixed_path = resolve_path(img_path, collection_path, search_paths)
expected_path = test_data_path(
'collections', 'test_collection', 'preview', 'prev_1.png')
self.assertEqual(fixed_path, expected_path)
# Test case 7: not finding anywhere (return the original path)
img_path = '/you/would/not/find/this/anywhere.png'
fixed_path = resolve_path(img_path, collection_path, search_paths)
self.assertEqual(fixed_path, img_path)
if __name__ == "__main__":
nose2.main()
ua = seqc.arrays.UniqueReadArray(data, features, positions)
self.assertTrue(ua.shape[0] == n_unique, 'Incorrect number of unique reads: '
'%d != %d' % (ua.shape[0], n_unique))
# check if other filters are causing it to fail
ua2 = ra.to_unique(3)
self.assertTrue(ua2.shape == ua.shape, 'Incongruent number of unique reads: '
'%d != %d' % (ua2.shape[0], ua.shape[0]))
self.assertTrue(ua2.shape[0] == 21984) # double check that the number is right
if __name__ == '__main__':
import nose2
# unittest.main()
nose2.main()
'ACTION_ON_DUPLICATE': 0}) # No action
self.assertIsNone(res['TARGET_LAYER']) # The algorithm doesn't run, and doesn't give an output
self.assertIsNone(res[APPENDED_COUNT])
self.assertIsNone(res[UPDATED_COUNT])
self.assertIsNone(res[SKIPPED_COUNT])
self.assertEqual(layer.featureCount(), 2)
@classmethod
def tearDownClass(self):
print('INFO: Tear down test_parameter_errors')
self.plugin.unload()
if __name__ == '__main__':
nose2.main()
self.assertEqual(setting_widget.widget_value(), default_value)
# set the widget with new value
setting_widget.set_widget_value(new_value)
# check that setting has been automatically updated
self.assertEqual(MySettings().value(setting_name), new_value)
self.dlg.close()
# reset setting
MySettings().remove(setting_name)
if __name__ == '__main__':
nose2.main()
seqc.log.info('SEQC working directory: %s' % os.getcwd())
seqc.log.info('Passed command line arguments: %s' %
json.dumps(arg_copy, separators=(',', ': '), indent=4))
func = kwargs['func']
func(**kwargs)
except:
seqc.log.exception()
raise
if __name__ == "__main__":
seqc.log.setup_logger()
try:
nose2.main(exit=False, module=__name__, verbosity=5)
except:
seqc.log.exception()
raise