예제 #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(" ")
예제 #2
0
 def test_unknown_fingerprint_family(self):
     with self.assertRaisesRegexp(ValueError, "Unknown fingerprint family 'Blah-Blah/1'"):
         types.parse_type("Blah-Blah/1")
예제 #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")
예제 #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)
예제 #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")
예제 #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")
예제 #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")
예제 #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)
예제 #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)
예제 #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")
예제 #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")
예제 #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")
예제 #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")
예제 #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")
예제 #15
0
 def test_unknown_fingerprint_family(self):
     with self.assertRaisesRegexp(
             ValueError, "Unknown fingerprint family 'Blah-Blah/1'"):
         types.parse_type("Blah-Blah/1")
예제 #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")
예제 #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")
예제 #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")
예제 #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")
예제 #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")
예제 #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")
예제 #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))
예제 #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)
예제 #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")
예제 #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))
예제 #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(" ")