示例#1
0
文件: test.py 项目: Gollor/database1
 def test_get_replace_city(self):
     loop.run_until_complete(city_generator.remove_cities())
     loop.run_until_complete(city_generator.insert_city(5))
     city = loop.run_until_complete(city_generator.get_city(5))
     city['name'] = 'replaced_city'
     loop.run_until_complete(city_generator.replace_city(5, city))
     loop.run_until_complete(city_generator.remove_cities())
示例#2
0
文件: test.py 项目: Gollor/database1
 def test_get_city(self):
     loop.run_until_complete(city_generator.remove_cities())
     loop.run_until_complete(city_generator.insert_city(5))
     self.assertIn('name', loop.run_until_complete(get_city_by_index(5)))
     self.assertIn('index', loop.run_until_complete(get_city_by_index(5)))
     self.assertIn('roads', loop.run_until_complete(get_city_by_index(5)))
     loop.run_until_complete(city_generator.remove_cities())
示例#3
0
文件: test.py 项目: Gollor/database1
 def test_state_generation(self):
     loop.run_until_complete(city_generator.remove_cities())
     loop.run_until_complete(city_generator.generate_state(20, 60))
     self.assertEqual(len(loop.run_until_complete(get_all_cities(200))), 20)
     loop.run_until_complete(city_generator.remove_cities())
示例#4
0
文件: test.py 项目: Gollor/database1
 def test_insert_city(self):
     loop.run_until_complete(city_generator.remove_cities())
     loop.run_until_complete(city_generator.insert_city(1))
     self.assertEqual(len(loop.run_until_complete(get_all_cities(200))), 1)
     loop.run_until_complete(city_generator.remove_cities())
示例#5
0
文件: test.py 项目: Gollor/database1
 def test_collection_cleaning(self):
     loop.run_until_complete(city_generator.remove_cities())