Exemplo n.º 1
0
 def t_no_integer_overflow_from_numpy(self, dtype, factor, i):
     """
     numpy int64 can't handle overflow (but does issue warning)
     """
     with pytest.warns(None) as record:
         Distro.NUMERIC_PADDING_FACTOR = factor
         try:
             sequence = [dtype(i)] * 2
         except OverflowError:
             return None
         Distro._well_within_range(sequence, sa.types.INT)
     assert len(record) == 0
Exemplo n.º 2
0
 def t_sqlite_prepare_engine(self, db, tmp_path):
     result = Distro.get("sqlite")
     if db == "sqlite.db":
         db = tmp_path / "sqlite.db"
     url, _ = result.create_spec(server="srvr",
                                 database=db,
                                 engine_kwargs={})
     assert str(db or ":memory:") in url
Exemplo n.º 3
0
 def t_prepare_for_other_engines(self, test_distro):
     if test_distro == "sqlite":
         pytest.skip("sqlite handled elsewhere")
     try:
         result = Distro.get(test_distro)
     except ModuleNotFoundError:
         pytest.skip(f"Missing {test_distro} module.")
     url, _ = result.create_spec(server="srvr",
                                 database="db",
                                 engine_kwargs=KeyReturner)
     assert test_distro in url
Exemplo n.º 4
0
 def t_get_exactly_one_distro_canonically(self, test_distro):
     try:
         result = Distro.get(test_distro)
         assert test_distro.lower() == result.name.lower()
     except ModuleNotFoundError:
         pytest.skip(f"Missing {test_distro} module.")
Exemplo n.º 5
0
 def t_fail_vague_distros(self, vaguename):
     with pytest.raises(SQLDistroNotFound):
         Distro.get(vaguename)
Exemplo n.º 6
0
 def t_fail_bad_distros(self, badname):
     with pytest.raises(SQLDistroNotFound):
         Distro.get(badname)
Exemplo n.º 7
0
 def t_get_exactly_one_distro_variants(self, canonical, incoming,
                                       test_distro):
     if canonical != test_distro:
         pytest.skip("")
     assert Distro.get(incoming).name == canonical
     assert Distro.get(incoming.upper()).name == canonical