예제 #1
0
class BasicTest(unittest2.TestCase):
    def setUp(self):
        self._client = ModelClient(os.environ.get(*legion.config.MODEL_ID),
                                   '1.1',
                                   token=build_client().get_token(
                                       os.environ.get(*legion.config.MODEL_ID),
                                       '1.0'))

    def test_model(self):
        response = self._client.invoke(
            **{
                "age": "31",
                "capital-gain": "14084",
                "capital-loss": 0,
                "education": "Bachelors",
                "education-num": "13",
                "fnlwgt": "77516",
                "hours-per-week": "40",
                "marital-status": "Married-civ-spouse",
                "native-country": "United-States",
                "occupation": "Exec-managerial",
                "race": "White",
                "relationship": "Husband",
                "sex": "Male",
                "workclass": "Private"
            })

        self.assertEqual(response['result'], 1)
예제 #2
0
class BasicTest(unittest2.TestCase):
    def setUp(self):
        self._client = ModelClient(os.environ.get(*legion.config.MODEL_ID))

    def test_nine_decode(self):
        image = load_image(os.path.join('files', 'nine.png'))
        response = self._client.invoke(image=image)
        self.assertEqual(response['digit'], 9)
예제 #3
0
class BasicTest(unittest2.TestCase):
    def setUp(self):
        self._client = ModelClient(os.environ.get(*legion.config.MODEL_ID))

    def test_random_sum(self):
        a = random.randint(0, 100)
        b = random.randint(0, 100)
        response = self._client.invoke(a=a, b=b)

        self.assertEqual(response['result'], a + b)
예제 #4
0
class BasicTest(unittest2.TestCase):
    def setUp(self):
        self._client = ModelClient(os.environ.get(*legion.config.MODEL_ID),
                                   '1.0',
                                   token=build_client().get_token(
                                       os.environ.get(*legion.config.MODEL_ID),
                                       '1.0'))

    def test_random_sum(self):
        a = random.randint(0, 100)
        b = random.randint(0, 100)
        response = self._client.invoke(a=a, b=b)

        self.assertEqual(response['result'], a + b,
                         'Wrong answer for a={} and b={}'.format(a, b))