Ejemplo n.º 1
0
 def test_no_type_string(self):
     with self.assertRaisesRegexp(ValueError,
                                  r"Empty fingerprint type \(''\)"):
         types.parse_type("")
     with self.assertRaisesRegexp(ValueError,
                                  r"Empty fingerprint type \(' '\)"):
         types.parse_type(" ")
Ejemplo n.º 2
0
 def test_unknown_fingerprint_family(self):
     with self.assertRaisesRegexp(ValueError, "Unknown fingerprint family 'Blah-Blah/1'"):
         types.parse_type("Blah-Blah/1")
Ejemplo n.º 3
0
 def test_passing_something_other_than_0_or_1(self):
     with self.assertRaisesRegexp(
             ValueError,
             r"Unable to parse useHs value '2' in type 'RDKit-Fingerprint useHs=2'"
     ):
         types.parse_type("RDKit-Fingerprint useHs=2")
Ejemplo n.º 4
0
 def test_compare_types_for_equality(self):
     t1 = types.parse_type("OpenEye-Path")
     self.assertEquals(t1, t1)
     t2 = types.parse_type("OpenEye-Path")
     self.assertEquals(t1, t2)
Ejemplo n.º 5
0
 def test_passing_0_to_positive_int(self):
     with self.assertRaisesRegexp(
             ValueError,
             "Unable to parse fpSize value '0' in type 'RDKit-Fingerprint fpSize=0'"
     ):
         types.parse_type("RDKit-Fingerprint fpSize=0")
Ejemplo n.º 6
0
 def test_extra_equals(self):
     with self.assertRaisesRegexp(
             ValueError,
             "Term 'atype=DefaultAtom=DefaultAtom' in type 'OpenEye-Path atype=DefaultAtom=DefaultAtom' must have one and only one '='"
     ):
         types.parse_type("OpenEye-Path atype=DefaultAtom=DefaultAtom")
Ejemplo n.º 7
0
 def test_unknown_name(self):
     with self.assertRaisesRegexp(
             ValueError,
             "Unknown name 'atomtype' in type 'OpenEye-Path atomtype=DefaultAtom'"
     ):
         types.parse_type("OpenEye-Path atomtype=DefaultAtom")
Ejemplo n.º 8
0
 def test_compare_types_for_equality(self):
     t1 = types.parse_type("OpenEye-Path")
     self.assertEquals(t1, t1)
     t2 = types.parse_type("OpenEye-Path")
     self.assertEquals(t1, t2)
Ejemplo n.º 9
0
 def test_compare_types_for_inequality(self):
     t1 = types.parse_type("OpenEye-Path")
     t2 = types.parse_type("OpenEye-Path atype=InRing")
     self.assertNotEquals(t1, t2)
Ejemplo n.º 10
0
 def test_unknown_name(self):
     with self.assertRaisesRegexp(ValueError, "Unknown name 'atomtype' in type 'OpenEye-Path atomtype=DefaultAtom'"):
         types.parse_type("OpenEye-Path atomtype=DefaultAtom")
Ejemplo n.º 11
0
 def test_negative_minbonds(self):
     with self.assertRaisesRegexp(ValueError, "Unable to parse minbonds value '-1' in type 'OpenEye-Path minbonds=-1'"):
         types.parse_type("OpenEye-Path minbonds=-1")
Ejemplo n.º 12
0
 def test_duplicate_names(self):
     with self.assertRaisesRegexp(ValueError, "Duplicate name 'atype' in type 'OpenEye-Path atype=DefaultAtom atype=InRing'"):
         types.parse_type("OpenEye-Path atype=DefaultAtom atype=InRing")
Ejemplo n.º 13
0
 def test_extra_equals(self):
     with self.assertRaisesRegexp(ValueError, "Term 'atype=DefaultAtom=DefaultAtom' in type 'OpenEye-Path atype=DefaultAtom=DefaultAtom' must have one and only one '='"):
         types.parse_type("OpenEye-Path atype=DefaultAtom=DefaultAtom")
Ejemplo n.º 14
0
 def test_missing_equals(self):
     with self.assertRaisesRegexp(ValueError, "Term 'atype' in type 'OpenEye-Path atype' must have one and only one '='"):
         types.parse_type("OpenEye-Path atype")
Ejemplo n.º 15
0
 def test_unknown_fingerprint_family(self):
     with self.assertRaisesRegexp(
             ValueError, "Unknown fingerprint family 'Blah-Blah/1'"):
         types.parse_type("Blah-Blah/1")
Ejemplo n.º 16
0
 def test_passing_0_to_positive_int(self):
     with self.assertRaisesRegexp(ValueError, "Unable to parse fpSize value '0' in type 'RDKit-Fingerprint fpSize=0'"):
         types.parse_type("RDKit-Fingerprint fpSize=0")
Ejemplo n.º 17
0
 def test_missing_equals(self):
     with self.assertRaisesRegexp(
             ValueError,
             "Term 'atype' in type 'OpenEye-Path atype' must have one and only one '='"
     ):
         types.parse_type("OpenEye-Path atype")
Ejemplo n.º 18
0
 def test_passing_negative_to_nonnegative_int(self):
     with self.assertRaisesRegexp(ValueError, r"Unable to parse fpSize value '\+2' in type 'RDKit-Fingerprint fpSize=\+2'"):
         types.parse_type("RDKit-Fingerprint fpSize=+2")
Ejemplo n.º 19
0
 def test_duplicate_names(self):
     with self.assertRaisesRegexp(
             ValueError,
             "Duplicate name 'atype' in type 'OpenEye-Path atype=DefaultAtom atype=InRing'"
     ):
         types.parse_type("OpenEye-Path atype=DefaultAtom atype=InRing")
Ejemplo n.º 20
0
 def test_passing_something_other_than_0_or_1(self):
     with self.assertRaisesRegexp(ValueError, r"Unable to parse useHs value '2' in type 'RDKit-Fingerprint useHs=2'"):
         types.parse_type("RDKit-Fingerprint useHs=2")
Ejemplo n.º 21
0
 def test_negative_minbonds(self):
     with self.assertRaisesRegexp(
             ValueError,
             "Unable to parse minbonds value '-1' in type 'OpenEye-Path minbonds=-1'"
     ):
         types.parse_type("OpenEye-Path minbonds=-1")
Ejemplo n.º 22
0
def get_fingerprinter(line, toolkit):
    fields = line.split()
    family = fields[0].format(TOOLKIT=toolkit)
    fields[0] = family
    return types.parse_type(" ".join(fields))
Ejemplo n.º 23
0
 def test_compare_types_for_inequality(self):
     t1 = types.parse_type("OpenEye-Path")
     t2 = types.parse_type("OpenEye-Path atype=InRing")
     self.assertNotEquals(t1, t2)
Ejemplo n.º 24
0
 def test_passing_negative_to_nonnegative_int(self):
     with self.assertRaisesRegexp(
             ValueError,
             r"Unable to parse fpSize value '\+2' in type 'RDKit-Fingerprint fpSize=\+2'"
     ):
         types.parse_type("RDKit-Fingerprint fpSize=+2")
Ejemplo n.º 25
0
def get_fingerprinter(line, toolkit):
    fields = line.split()
    family = fields[0].format(TOOLKIT=toolkit)
    fields[0] = family
    return types.parse_type(" ".join(fields))
Ejemplo n.º 26
0
 def test_no_type_string(self):
     with self.assertRaisesRegexp(ValueError, r"Empty fingerprint type \(''\)"):
         types.parse_type("")
     with self.assertRaisesRegexp(ValueError, r"Empty fingerprint type \(' '\)"):
         types.parse_type(" ")