Testing a website using Safari on Linux
While it's not entirely the same thing, you could use one of the WebKit Linux ports to run "mostly Safari" on Linux. However, if you're intent on running macOS on non-Apple hardware, there are ways. However, note that these methods may violate Apple's macOS SLA.

According to Apple's macOS 10.12 SLA, you may use your limited, non- transferable, non-exclusive license:


  to install, use and run up to two (2) additional copies or instances
  of the Apple Software within virtual operating system environments on
  each Mac Computer you own or control that is already running the Apple
  Software, for purposes of: (a) software development; (b) testing
  during software development; (c) using macOS Server; or (d) personal,
  non-commercial use.


From a technical perspective, there's nothing that would prevent you from running a VM on non-Apple hardware, though you would clearly be in violation of the SLA, and as such, I can't recommend you do this. However, if you decide to run a VM on Apple hardware, it's possible to create a compatible ISO. In any case, you'd need access to a macOS equipped machine.

Again, while clearly in violate of the SLA, there are methods to put macOS on non-Apple hardware, generally known as Hackintoshing. Again, I cannot condone this, but it is technically possible.

The easiest and most legally clear method is still to run Safari on Apple hardware, and that's what I'd recommend.