Ejemplo n.º 1
0
    def test_get(self):
        bytes_received = session_status.get('Bytes_received')
        assert isinstance(bytes_received, int)
        assert bytes_received >= 0

        bytes_received_2 = session_status.get('Bytes_received')
        assert bytes_received_2 >= bytes_received

        cost = session_status.get('Last_query_cost')
        assert isinstance(cost, float)
        assert cost >= 0.00

        with pytest.raises(ValueError) as excinfo:
            session_status.get('foo%')
        assert 'wildcards' in str(excinfo.value)

        with pytest.raises(KeyError):
            session_status.get('Does_not_exist')
Ejemplo n.º 2
0
    def test_get(self):
        bytes_received = session_status.get('Bytes_received')
        self.assertTrue(isinstance(bytes_received, int))
        self.assertGreaterEqual(bytes_received, 0)

        bytes_received_2 = session_status.get('Bytes_received')
        self.assertGreaterEqual(bytes_received_2, bytes_received)

        cost = session_status.get('Last_query_cost')
        self.assertTrue(isinstance(cost, float))
        self.assertGreaterEqual(cost, 0.00)

        with self.assertRaises(ValueError) as cm:
            session_status.get('foo%')
        self.assertIn('wildcards', str(cm.exception))

        with self.assertRaises(KeyError):
            session_status.get('Does_not_exist')
Ejemplo n.º 3
0
 def test_get_non_existent(self):
     with pytest.raises(KeyError):
         session_status.get('Does_not_exist')
Ejemplo n.º 4
0
 def test_get_bad_name(self):
     with pytest.raises(ValueError) as excinfo:
         session_status.get('foo%')
     assert 'wildcards' in str(excinfo.value)
Ejemplo n.º 5
0
 def test_get_last_query_cost(self):
     cost = session_status.get('Last_query_cost')
     assert cost >= 0.0 and isinstance(cost, float)
Ejemplo n.º 6
0
    def test_get_bytes_received(self):
        bytes_received = session_status.get('Bytes_received')
        assert bytes_received >= 0 and isinstance(bytes_received, int)

        bytes_received_2 = session_status.get('Bytes_received')
        assert bytes_received_2 >= bytes_received
Ejemplo n.º 7
0
 def test_get_non_existent(self):
     with pytest.raises(KeyError):
         session_status.get('Does_not_exist')
Ejemplo n.º 8
0
 def test_get_bad_name(self):
     with pytest.raises(ValueError) as excinfo:
         session_status.get('foo%')
     assert 'wildcards' in str(excinfo.value)
Ejemplo n.º 9
0
 def test_get_last_query_cost(self):
     cost = session_status.get('Last_query_cost')
     assert cost >= 0.0 and isinstance(cost, float)
Ejemplo n.º 10
0
    def test_get_bytes_received(self):
        bytes_received = session_status.get('Bytes_received')
        assert bytes_received >= 0 and isinstance(bytes_received, int)

        bytes_received_2 = session_status.get('Bytes_received')
        assert bytes_received_2 >= bytes_received