def test_get_many(self): myvars = global_status.get_many([]) assert myvars == {} myvars = global_status.get_many(['Threads_running', 'Uptime']) assert isinstance(myvars, dict) assert 'Threads_running' in myvars assert isinstance(myvars['Threads_running'], int) assert 'Uptime' in myvars assert isinstance(myvars['Uptime'], int) with pytest.raises(ValueError) as excinfo: global_status.get_many(['foo%']) assert 'wildcards' in str(excinfo.value)
def test_get_many(self): myvars = global_status.get_many([]) self.assertEqual(myvars, {}) myvars = global_status.get_many(['Threads_running', 'Uptime']) self.assertTrue(isinstance(myvars, dict)) self.assertIn('Threads_running', myvars) self.assertTrue(isinstance(myvars['Threads_running'], int)) self.assertIn('Uptime', myvars) self.assertTrue(isinstance(myvars['Uptime'], int)) with self.assertRaises(ValueError) as cm: global_status.get_many(['foo%']) self.assertIn('wildcards', str(cm.exception))
def test_get_many_existent(self): myvars = global_status.get_many(['Threads_running', 'Uptime']) assert isinstance(myvars, dict) assert 'Threads_running' in myvars assert isinstance(myvars['Threads_running'], int) assert 'Uptime' in myvars assert isinstance(myvars['Uptime'], int)
def test_get_many_existent(self): myvars = global_status.get_many(["Threads_running", "Uptime"]) assert isinstance(myvars, dict) assert "Threads_running" in myvars assert isinstance(myvars["Threads_running"], int) assert "Uptime" in myvars assert isinstance(myvars["Uptime"], int)
def test_get_many_bad_name(self): with pytest.raises(ValueError) as excinfo: global_status.get_many(['foo%']) assert 'wildcards' in str(excinfo.value)
def test_get_many_empty(self): myvars = global_status.get_many([]) assert myvars == {}