Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_version_base_version(self, version, base_version):
assert Version(version).base_version == base_version
}
})
if 'spark' in workloads:
if Version(dse_version) >= Version('6.8'):
config_options = {
"resource_manager_options": {
"worker_options": {
"cores_total": 0.1,
"memory_total": "64M"
}
}
}
else:
config_options = {"initial_spark_worker_resources": 0.1}
if Version(dse_version) >= Version('6.7'):
log.debug("Disabling AlwaysON SQL for a DSE 6.7 Cluster")
config_options['alwayson_sql_options'] = {'enabled': False}
CCM_CLUSTER.set_dse_configuration_options(config_options)
common.switch_cluster(path, cluster_name)
CCM_CLUSTER.set_configuration_options(configuration_options)
CCM_CLUSTER.populate(nodes, ipformat=ipformat)
CCM_CLUSTER.set_dse_configuration_options(dse_options)
else:
CCM_CLUSTER = CCMCluster(path, cluster_name, **ccm_options)
CCM_CLUSTER.set_configuration_options({'start_native_transport': True})
if Version(cassandra_version) >= Version('2.2'):
CCM_CLUSTER.set_configuration_options({'enable_user_defined_functions': True})
if Version(cassandra_version) >= Version('3.0'):
CCM_CLUSTER.set_configuration_options({'enable_scripted_user_defined_functions': True})
if Version(cassandra_version) >= Version('4.0-a'):
self.assertEqual(len(v.properties['mult_key']), 2)
self.assertEqual(v.properties['mult_key'][0].label, 'mult_key')
self.assertEqual(v.properties['mult_key'][1].label, 'mult_key')
self.assertEqual(v.properties['mult_key'][0].value, 'value0')
self.assertEqual(v.properties['mult_key'][1].value, 'value1')
# single_with_one_value
v = self.execute_graph('''v = graph.addVertex('SW1')
v.property('single_key', 'value')
v''', graphson)[0]
self.assertEqual(len(v.properties), 1)
self.assertEqual(len(v.properties['single_key']), 1)
self.assertEqual(v.properties['single_key'][0].label, 'single_key')
self.assertEqual(v.properties['single_key'][0].value, 'value')
if DSE_VERSION < Version('6.8'):
# single_with_two_values
with self.assertRaises(InvalidRequest):
v = self.execute_graph('''
v = graph.addVertex('SW1')
v.property('single_key', 'value0').property('single_key', 'value1').next()
v
''', graphson)[0]
else:
# >=6.8 single_with_two_values, first one wins
v = self.execute_graph('''v = graph.addVertex('SW1')
v.property('single_key', 'value0').property('single_key', 'value1')
v''', graphson)[0]
self.assertEqual(v.properties['single_key'][0].value, 'value0')
def __test_udt(self, schema, graphson, address_class, address_with_tags_class,
complex_address_class, complex_address_with_owners_class):
if schema is not CoreGraphSchema or DSE_VERSION < Version('6.8'):
raise unittest.SkipTest("Graph UDT is only supported with DSE 6.8+ and Core graphs.")
ep = self.get_execution_profile(graphson)
Address = address_class
AddressWithTags = address_with_tags_class
ComplexAddress = complex_address_class
ComplexAddressWithOwners = complex_address_with_owners_class
# setup udt
self.session.execute_graph("""
schema.type('address').property('address', Text).property('city', Text).property('state', Text).create();
schema.type('addressTags').property('address', Text).property('city', Text).property('state', Text).
property('tags', setOf(Text)).create();
schema.type('complexAddress').property('address', Text).property('address_tags', frozen(typeOf('addressTags'))).
property('city', Text).property('state', Text).property('props', mapOf(Text, Int)).create();
def test_is_license_valid(self):
if Version(fgt.get_version()) > Version('5.6'):
self.assertTrue(fgt.license()['results']['vm']['status'] == "vm_valid" or "vm_eval")
else:
self.assertTrue(True, "not supported before 5.6")
assert result == SpecifierSet(expected)
assert result.prereleases
result = SpecifierSet(left, prereleases=False) & SpecifierSet(right)
assert result == SpecifierSet(expected)
assert not result.prereleases
result = SpecifierSet(left) & SpecifierSet(right, prereleases=True)
assert result == SpecifierSet(expected)
assert result.prereleases
result = SpecifierSet(left) & SpecifierSet(right, prereleases=False)
assert result == SpecifierSet(expected)
assert not result.prereleases
result = SpecifierSet(left, prereleases=True) & SpecifierSet(
right, prereleases=True
)
assert result == SpecifierSet(expected)
assert result.prereleases
result = SpecifierSet(left, prereleases=False) & SpecifierSet(
right, prereleases=False
)
assert result == SpecifierSet(expected)
assert not result.prereleases
with pytest.raises(ValueError):
result = SpecifierSet(left, prereleases=True) & SpecifierSet(
right, prereleases=False
)
def __init__(self, project_name, specs, extras):
"""DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!"""
self.unsafe_name, project_name = project_name, safe_name(project_name)
self.project_name, self.key = project_name, project_name.lower()
self.specifier = packaging.specifiers.SpecifierSet(
",".join(["".join([x, y]) for x, y in specs])
)
self.specs = specs
self.extras = tuple(map(safe_extra, extras))
self.hashCmp = (
self.key,
self.specifier,
frozenset(self.extras),
)
self.__hash = hash(self.hashCmp)
def test_specifiers_combine(self, left, right, expected):
result = SpecifierSet(left) & SpecifierSet(right)
assert result == SpecifierSet(expected)
result = SpecifierSet(left) & right
assert result == SpecifierSet(expected)
result = SpecifierSet(left, prereleases=True) & SpecifierSet(right)
assert result == SpecifierSet(expected)
assert result.prereleases
result = SpecifierSet(left, prereleases=False) & SpecifierSet(right)
assert result == SpecifierSet(expected)
assert not result.prereleases
result = SpecifierSet(left) & SpecifierSet(right, prereleases=True)
assert result == SpecifierSet(expected)
assert result.prereleases
def test_comparison_canonicalizes(self, left, right):
assert SpecifierSet(left) == SpecifierSet(right)
assert left == SpecifierSet(right)
assert SpecifierSet(left) == right
def test_major_only_python_version(self):
result = list(tags.cpython_tags((3,), ["abi"], ["plat"]))
assert result == [
tags.Tag("cp3", "abi", "plat"),
tags.Tag("cp3", "none", "plat"),
]