예제 #1
0
파일: test_xy.py 프로젝트: Cougar/pyxy
 def test_one_area(self):
     m = XY(-100, -100, 100, 100)
     m.add_area(10, 20, -30, -40, 'test')
     self.assertEqual(len(m.areas), 5)
     self.assertEqual(m.get_area_count(), (1, 4))
     self.assertEqual(m.find_area(0, 0).name, 'test')
     self.assertEqual(m.find_area(20, 10).name, None)
예제 #2
0
파일: test_xy.py 프로젝트: Cougar/pyxy
	def test_one_area(self):
		m = XY(-100, -100, 100, 100)
		m.add_area(10, 20, -30, -40, 'test')
		self.assertEqual(len(m.areas), 5)
		self.assertEqual(m.get_area_count(), (1, 4))
		self.assertEqual(m.find_area(0, 0).name, 'test')
		self.assertEqual(m.find_area(20, 10).name, None)
예제 #3
0
파일: test_xy.py 프로젝트: Cougar/pyxy
class XYTests(unittest.TestCase):
    def setUp(self):
        self.m = XY(-100, -100, 100, 100)

    def test_empty_map(self):
        self.assertEqual(len(self.m.areas), 1)
        self.assertEqual(self.m.get_area_count(), (0, 1))
        self.assertEqual(self.m.find_area(0, 0).name, None)

    def test_one_area_replace(self):
        self.m.add_area(-100, -100, 100, 100, 'test')
        self.assertEqual(len(self.m.areas), 1)
        self.assertEqual(self.m.get_area_count(), (1, 0))
        self.assertEqual(self.m.find_area(0, 0).name, 'test')

    def test_one_area(self):
        m = XY(-100, -100, 100, 100)
        m.add_area(10, 20, -30, -40, 'test')
        self.assertEqual(len(m.areas), 5)
        self.assertEqual(m.get_area_count(), (1, 4))
        self.assertEqual(m.find_area(0, 0).name, 'test')
        self.assertEqual(m.find_area(20, 10).name, None)

    def test_area_overlaps(self):
        self.m.add_area(-20, -20, 20, 20, 'test')
        self.assertRaises(Exception, self.m.add_area, -10, -10, 10, 10,
                          'test2')
        self.assertRaises(Exception, self.m.add_area, -30, -30, 30, 30,
                          'test3')
        self.assertRaises(Exception, self.m.add_area, -30, -30, 10, 10,
                          'test4')
예제 #4
0
파일: test_xy.py 프로젝트: Cougar/pyxy
class XYTests(unittest.TestCase):
	def setUp(self):
		self.m = XY(-100, -100, 100, 100)

	def test_empty_map(self):
		self.assertEqual(len(self.m.areas), 1)
		self.assertEqual(self.m.get_area_count(), (0, 1))
		self.assertEqual(self.m.find_area(0, 0).name, None)

	def test_one_area_replace(self):
		self.m.add_area(-100, -100, 100, 100, 'test')
		self.assertEqual(len(self.m.areas), 1)
		self.assertEqual(self.m.get_area_count(), (1, 0))
		self.assertEqual(self.m.find_area(0, 0).name, 'test')

	def test_one_area(self):
		m = XY(-100, -100, 100, 100)
		m.add_area(10, 20, -30, -40, 'test')
		self.assertEqual(len(m.areas), 5)
		self.assertEqual(m.get_area_count(), (1, 4))
		self.assertEqual(m.find_area(0, 0).name, 'test')
		self.assertEqual(m.find_area(20, 10).name, None)

	def test_area_overlaps(self):
		self.m.add_area(-20, -20, 20, 20, 'test')
		self.assertRaises(Exception, self.m.add_area, -10, -10, 10, 10, 'test2')
		self.assertRaises(Exception, self.m.add_area, -30, -30, 30, 30, 'test3')
		self.assertRaises(Exception, self.m.add_area, -30, -30, 10, 10, 'test4')