def test_parse_appsinstalled__success(self): line = "d_type\td_id\t3.667\t359.12\t44,xabc, 1234 ,xggf" appsinst = memc_load.parse_appsinstalled_utf8(line) self.assertAlmostEqual(appsinst.lat, 3.667) self.assertAlmostEqual(appsinst.lon, 359.12) self.assertTrue(appsinst.dev_id, 'd_id') self.assertTrue(appsinst.dev_type, 'd_type') self.assertListEqual(appsinst.apps, [44, 1234])
def test_parse_appsinstalled__wrong_parts_count(self): line = "1\t2\t3\t4" self.assertIsNone(memc_load.parse_appsinstalled_utf8(line))
def test_parse_appsinstalled__wrong_apps(self): line = "1\t2\t3\t4\txabc, 1234 ,xggf" appsinst = memc_load.parse_appsinstalled_utf8(line) self.assertListEqual(appsinst.apps, [1234])
def test_parse_appsinstalled__wrong_coords(self): line = "1\t2\tlat\tlon\txabc, 1234 ,xggf" appsinst = memc_load.parse_appsinstalled_utf8(line) self.assertTrue(appsinst.lon == 'lon') self.assertTrue(appsinst.lat == 'lat')
def test_parse_appsinstalled__wrong_dev(self): line = "1\t\t\t4\t5" self.assertIsNone(memc_load.parse_appsinstalled_utf8(line))