def test_empty(self): hostlist = restrict_hostlist([], None, None) self.assertEqual(hostlist, [])
def test_startat_and_stopbefore(self): hostlist = restrict_hostlist(self.hostlist, "c", "e") self.assertEqual(hostlist, self.hostlist[2:-2])
def test_stopbefore_before_startat(self): hostlist = restrict_hostlist(self.hostlist, "e", "c") self.assertEqual(hostlist, [])
def test_startat(self): hostlist = restrict_hostlist(self.hostlist, "c", None) self.assertEqual(hostlist, self.hostlist[2:])
def test_stopbefore(self): hostlist = restrict_hostlist(self.hostlist, None, "c") self.assertEqual(hostlist, self.hostlist[:2])
def test_invalid_startat(self): with self.assertRaises(HostSelectionError): restrict_hostlist([], "a", None)
def test_invalid_stopbefore(self): with self.assertRaises(HostSelectionError): restrict_hostlist([], None, "a")
def test_stopbefore(self): hostlist = restrict_hostlist(self.hostlist, None, "c") self.assertEqual(hostlist, ["a", "b"])
def test_startat_and_stopbefore(self): hostlist = restrict_hostlist(self.hostlist, "c", "e") self.assertEqual(hostlist, ["c", "d"])
def test_startat(self): hostlist = restrict_hostlist(self.hostlist, "c", None) self.assertEqual(hostlist, ["c", "d", "e", "f"])