From 066577020058f856b91893bea56deffe6384f818 Mon Sep 17 00:00:00 2001 From: Petr Šplíchal Date: Tue, 26 Jul 2011 13:27:00 +0200 Subject: Nitrate: ID may be provided as a string --- Nitrate.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Nitrate.py') diff --git a/Nitrate.py b/Nitrate.py index 1325726..c782328 100644 --- a/Nitrate.py +++ b/Nitrate.py @@ -289,8 +289,11 @@ class Nitrate(object): elif isinstance(id, int): self._id = id else: - raise NitrateError("Invalid {0} id: '{1}'".format( - self.__class__.__name__, id)) + try: + self._id = int(id) + except ValueError: + raise NitrateError("Invalid {0} id: '{1}'".format( + self.__class__.__name__, id)) def __str__(self): """ Short summary about the connection. """ @@ -1273,7 +1276,7 @@ class TestRun(Mutable): self._caseruns = [ CaseRun(testcasehash=testcase, caserunhash=caserun) for caserun in caseruns for testcase in testcases - if testcase["case_id"] == caserun["case_id"]] + if int(testcase["case_id"]) == int(caserun["case_id"])] return self._caseruns @property -- cgit